ch-wew
Last Updated: August 23, 2018
·
1.488K
· mlafeldt

Git alias to generate the changelog

When releasing a new version of a project, I usually document the changes since the last release in CHANGELOG.md (or HISTORY.md). For this, I used to take the output of git shortlog and edit it manually.

Now, as I'm a lazy programmer, I've written git changelog - a Git alias that generates the changelog for me.

Without any argument, git changelog will print all changes since the last tag:

$ git changelog 
Changelog for v0.1.2..HEAD
* Update to md_inc v0.2.8
* Add JekyllPage class
* Remove trailing empty lines from content
* Re-add quotes to post title
* Add Travis config (no tests yet)
* Add HISTORY.md file

As you can see, the output is Markdown and can be inserted into CHANGELOG.md almost as-is.

Last but not least, you can pass git changelog a commit range like this:

$ git changelog v0.1.0..v0.1.1