A few months ago I wrote about a “poor man’s changelog” in Git. This post is a short follow-up with another tip on how to make this “changelog” more useful. Previously, I lazily used the --oneline
format for Git commits, which is roughly equivalent to --pretty=tformat:"%h%d %s"
. (See the git-log
man page for the meaning of %h
, %d
, %s
and many other such placeholders.) The tformat
, as opposed to format
, adds a newline after each commit instead of between every two subsequent commits, effectively terminating the last one with a newline (at least this is what the manpage says, I could not spot the difference…).
After reading the git-log
manpage and playing around with various variants, I settled on this incantation: --pretty=tformat:"%as %s
(author %an, reviewer %cn)"
. Since BitBucket (which I happen to be using in the project I created my “changelog” script for) marks pull request merges as authored by the creator of the PR (who is usually the author of the changes) and committed by the person who accepted the PR (who is usually the reviewer of the changes), this makes perfect sense and gives a very nice summary of what PRs were merged, when, and by whom.