Is there an easy way or command to get all git commits up to a specific tag to generate an automatic changelog for a project? I always tag my git repos with a version number lik
An update to the script suggested by Creotiv to get better sorting of the tags
#!/bin/bash
# Author:Andrey Nikishaev, Gunnar Lindholm
echo "CHANGELOG"
echo ----------------------
git for-each-ref --sort='*authordate' --format='%(tag)' refs/tags |tac |grep -v '^$' | while read TAG ; do
echo
if [ $NEXT ];then
echo [$NEXT]
else
echo "[Current]"
fi
GIT_PAGER=cat git log --no-merges --format=" * %s" $TAG..$NEXT
NEXT=$TAG
done
FIRST=$(git tag -l | head -1)
echo
echo [$FIRST]
GIT_PAGER=cat git log --no-merges --format=" * %s" $FIRST
Just append tagname
to your command and you should be fine :) I like the --graph
switch to visualize the branches that led to that tag :)
For creating changelog by tags, i used this script:
#!/bin/bash
# Author:Andrey Nikishaev
echo "CHANGELOG"
echo ----------------------
git tag -l | sort -u -r | while read TAG ; do
echo
if [ $NEXT ];then
echo [$NEXT]
else
echo "[Current]"
fi
GIT_PAGER=cat git log --no-merges --format=" * %s" $TAG..$NEXT
NEXT=$TAG
done
FIRST=$(git tag -l | head -1)
echo
echo [$FIRST]
GIT_PAGER=cat git log --no-merges --format=" * %s" $FIRST