Created
June 26, 2017 10:21
-
-
Save lastguest/b22004a52383d7e18138d87dee26056c to your computer and use it in GitHub Desktop.
[GIT Changelog] GIT Tag-based Changelog Generator #git #changelog #shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# GIT CHANGELOG Generator | |
# Stefano Azzolini <[email protected]> | |
# | |
# Use parameter --skip-head to skip HEAD section | |
LOG_FORMAT="\`%h\` **%s** _by %an_ " | |
function changelog_for_tag() { | |
echo "## $2\n" | |
git --no-pager log $1...$2 --pretty=format:"$LOG_FORMAT" --no-merges --no-color | |
echo "\n" | |
} | |
LAST_TAG="HEAD" | |
for TAG in `git tag -l | tail -r | grep '^\d'`; do | |
if [ "$LAST_TAG" == "HEAD" ] && [ $1 == '--skip-head' ]; then | |
LAST_TAG=$TAG | |
continue | |
fi | |
changelog_for_tag $TAG $LAST_TAG | |
LAST_TAG=$TAG | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment