How to sync Git commit message, tag message and the CHANGELOG

510 views Asked by At

I want to know the best practices for handling the above. I keep a changelog for my project which I update with detailed information on changes. I also add a summary to the commit message, and add a similar message to the version tag. But what's the difference between, say, a summary on changelog, the commit message, and tag message?


CHANGELOG

v1.0.0 - Added this that and that, and changed this.

  • change 1
  • change 2
  • change three or somthing

git commit -am "..."

Added this that and that, and changed this.


git tag v1.0.0 -m "..."

v1.0.0 - Added this that and that, and changed this.


1

There are 1 answers

1
VonC On BEST ANSWER

A tag message can represent a summary of the changes, not a specific step like commits do.
The changes happens between two tags.

Actually, if your commmit messages are well written, you could extract from them your changelog: see "Very Easy Changelogs with Git"

git log 1.0.0...1.1.0 --no-merges --pretty=format:'<li> %s &mdash; %cn &bull; <a href="http://github.com/<username>/<repo>commit/%H" target="_blank">%h</a></li>'

That can generate a changelog HTML page similar to http://mun.ee/Changelog.
That way, you don't have to version and maintain a separate ChangeLog.md file.


Note: starting git 2.0.x/git 2.1 (Q3 2014), the name of the tag will be part of the default prompt message.
See commit d78f340 by (mirabilos):

builtin/tag.c: show tag name to hint in the message editor

Display the tag name about to be added to the user during interactive editing.