Skip to content

Instantly share code, notes, and snippets.

@xcodebuild
Created February 6, 2015 06:40
Show Gist options
  • Save xcodebuild/240b25be2fb9e24f11ba to your computer and use it in GitHub Desktop.
Save xcodebuild/240b25be2fb9e24f11ba to your computer and use it in GitHub Desktop.
changelog.sh
#!/bin/bash
# Author: tim.tang
rm -f changelog.md
git for-each-ref --sort='*authordate' --format='%(tag)' refs/tags | grep -v '^$' | tail -r | while read TAG ; do
echo
if [ $NEXT ];then
echo ' ' >> changelog.md
echo *$NEXT* >> changelog.md
echo '---' >> changelog.md
else
echo ' ' >> changelog.md
echo *CURRENT* >> changelog.md
echo '---' >> changelog.md
fi
echo ' ' >> changelog.md
GIT_PAGER=cat git log --no-merges --date=short --pretty=format:'- %ad (%an) %s -> [view commit](https://github.com/xplusz/smartbus-nodejs/commit/%H)' $TAG..$NEXT >> changelog.md
echo ' ' >> changelog.md
NEXT=$TAG
done
echo "DONE."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment