Reading Time: 2 minutes

Here’s a useful command that I’ve been using for a while. It generates a changelog, based on all merge commits since the latest release was tagged.

git log $(git describe –abbrev=0 –tags)..
–merges –pretty=format:”%b”
| grep -E ‘^[A-Z]+-[0-9]+’

If we break this down, we get to the following:

git describe –abbrev=0 –tags

This will give you the latest tag name, eg: 1.24.3. This value will be parsed in the git log command, as follows:

git log 1.24.3..
–merges –pretty=format:”%b”
| grep -E ‘^[A-Z]+-[0-9]+’

The flag --merges makes sure that only merge commits are included.--pretty-format:"%b" will limit the output from git log to only include the body of the merge commit. So given the following merge commit:

commit 5e15780ffad8ba4838e84916f64a2bbbf785f19b
Merge: db6e41a f1607b8
Author: Anse <john@doe.com>
Date:   Tue Mar 27 15:08:07 2018 +0200

Merge pull request #1005 from xxx/feature/TICKET-3036

TICKET-3036: Ticket description goes here

It would output: TICKET-3036: Ticket description goes here

After that we’ll narrow down the output to only include lines that start with a ticket number, using grep -E '^[A-Z]+-[0–9]+'

Written by Andries Seutens

Software Engineer

Are you in need of a complex system that is easy to maintain? Then Andries is your guy. Not only is he a fantastic API-developer, he is also fairly knowledgeable in the area of architecture.

Published on: March 28th, 2018

Newsletter

Become an app expert? Leave your e-mail.

nederlandse loterij en egeniq
pathe thuis en egeniq
rpo and egeniq
mvw en egeniq
rtl and egeniq