DISCLAIMER: I'm the author of gitchangelog of which I'll be speaking in the following.
TL;DR: You might want to check gitchangelog's own changelog or the ascii output that generated the previous.
If you want to generate a changelog from your git history, you'll probably have to consider:
- the output format. (Pure custom ASCII, Debian changelog type, Markdow, ReST...)
- some commit filtering (you probably don't want to see all the typo's or cosmetic changes getting in your changelog)
- some commit text wrangling before being included in the changelog. (Ensuring normalization of messages as having a first letter uppercase or a final dot, but it could be removing some special markup in the summary also)
- is your git history compatible ?. Merging, tagging, is not always so easily supported by most of the tools. It depends on how you manage your history.
Optionaly you might want some categorization (new things, changes, bugfixes)...
With all this in mind, I created and use gitchangelog. It's meant to leverage a git commit message convention to achieve all of the previous goals.
Having a commit message convention is mandatory to create a nice changelog (with or without using gitchangelog
).
commit message convention
The following are suggestions to what might be useful to think about adding in your commit messages.
You might want to separate roughly your commits into big sections:
- by intent (for example: new, fix, change ...)
- by object (for example: doc, packaging, code ...)
- by audience (for example: dev, tester, users ...)
Additionally, you could want to tag some commits:
- as "minor" commits that shouldn't get outputed to your changelog (cosmetic changes, small typo in comments...)
- as "refactor" if you don't really have any significative feature changes. Thus this should not also be part of the changelog displayed to final user for instance, but might be of some interest if you have a developer changelog.
- you could tag also with "api" to mark API changes or new API stuff...
- ...etc...
Try to write your commit message by targeting users (functionality) as often as you can.
example
This is standard git log --oneline
to show how these information could be stored::
* 5a39f73 fix: encoding issues with non-ascii chars.
* a60d77a new: pkg: added ``.travis.yml`` for automated tests.
* 57129ba new: much greater performance on big repository by issuing only one shell command for all the commits. (fixes #7)
* 6b4b267 chg: dev: refactored out the formatting characters from GIT.
* 197b069 new: dev: reverse ``natural`` order to get reverse chronological order by default. !refactor
* 6b891bc new: add utf-8 encoding declaration !minor
So if you've noticed, the format I chose is:
{new|chg|fix}: [{dev|pkg}:] COMMIT_MESSAGE [!{minor|refactor} ... ]
To see an actual output result, you could look at the end of the PyPI page of gitchangelog
To see a full documentation of my commit message convention you can see the reference file gitchangelog.rc.reference
How to generate exquisite changelog from this
Then, it's quite easy to make a complete changelog. You could make your own script quite quickly, or use gitchangelog
.
gitchangelog
will generate a full changelog (with sectioning support as New
, Fix
...), and is reasonably configurable to your own committing conventions. It supports any type of output thanks to templating through Mustache
, Mako templating
, and has a default legacy engine written in raw python ; all current 3 engines have examples of how to use them and can output changelog's as the one displayed on the PyPI page of gitchangelog.
I'm sure you know that there are plenty of other git log
to changelog
tools out there also.