Last active
December 29, 2015 13:29
-
-
Save mablae/7677445 to your computer and use it in GitHub Desktop.
Creates a GIT Changelog based on Tags
This file contains 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/bash | |
tags=() | |
for tag in $(git for-each-ref --sort='-refname:short' --format='%(refname:short)' refs/tags) ; do | |
tags+=($tag) | |
done | |
lastTag=0 | |
totalTags=${#tags[*]} | |
mylog="changelog.txt" | |
echo "" > "$mylog" | |
for (( i=0; i<= $(($totalTags - 1)); i++ )) ; do | |
printOut=${tags["$i"]} | |
next=${tags["$i"+1]} | |
currentTag="$i" | |
echo "v. $printOut" >> $mylog | |
if (( $i+1==$totalTags )) ; then | |
git log --date=short --oneline --format=' - %s' "$printOut" >> "$mylog" | |
else | |
git log --date=short --oneline --format=' - %s' "$next".."$printOut" >> "$mylog" | |
fi | |
lastTag="$currentTag" | |
echo "" >> "$mylog" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment