Describe Merges!
—
Changelog is important. Changelog is linear. Git history isn’t linear, but it
could be, thanks to git log --first-parent
. With this switch enabled we
won’t see all the tiny commits from the merged branch, but just a merge
commit. This is why it’s good to have a general description of changes in
merge commits instead of the usual “Merge branch ‘feat’ into ‘master’“.
This approach helps generation of changelog. For example, we could devise a script to show and pretty-format description of all changes since the last tag:
#!/bin/sh
LAST_TAG=`git describe --tags --abbrev=0`
echo "Changes since $LAST_TAG:"
echo ""
git log --first-parent --pretty="format:* %w(0,0,2)%B" ${LAST_TAG}...HEAD | dos2unix | sed -e '/^ See merge request ![0-9]\+.*$/d' -e 's/^ $//' | cat -s