Skip to content

Instantly share code, notes, and snippets.

@anthonyterrell
Created February 19, 2018 19:36
Show Gist options
  • Save anthonyterrell/f6f7a13dce5ec199b3fe295fdb68d900 to your computer and use it in GitHub Desktop.
Save anthonyterrell/f6f7a13dce5ec199b3fe295fdb68d900 to your computer and use it in GitHub Desktop.
Generate git changelog
#!/usr/bin/env bash
previous_tag=0
for current_tag in $(git tag --sort=-creatordate)
do
if [ "$previous_tag" != 0 ];then
tag_date=$(git log -1 --pretty=format:'%ad' --date=short ${previous_tag})
printf "## ${previous_tag} (${tag_date})\n\n"
git log ${current_tag}...${previous_tag} --pretty=format:'* %s [View](https://bitbucket.org/projects/test/repos/my-project/commits/%H)' --reverse | grep -v Merge
printf "\n\n"
fi
previous_tag=${current_tag}
done
#######################
# credit to https://stackoverflow.com/users/7260022/waku-2
# https://stackoverflow.com/a/46033999/1492007
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment