Skip to content

Instantly share code, notes, and snippets.

@vst
Created November 3, 2014 03:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vst/67d3ba99587d94922085 to your computer and use it in GitHub Desktop.
Save vst/67d3ba99587d94922085 to your computer and use it in GitHub Desktop.
Changelog preperation script for Git repositories
#!/bin/bash
########################################################################
# Description:
# Produces custom ChangeLog file contents out of the "git log"
#
# Usage:
# sh changelog.sh
#
# Usage (Save output):
# sh changelog.sh > ChangeLog
########################################################################
branch_name=$(git symbolic-ref -q HEAD)
branch_name=${branch_name##refs/heads/}
branch_name=${branch_name:-HEAD}
today=$(date +"%Y-%m-%d")
echo VERSION: $today ------- $branch_name
echo
git log --date=short --pretty=" * %ad %h %s (%ae)" | sed "s/^ \* \(.*\) \(.......\) Merge branch '\([^f].*\)' into develop \(.*\)$/\\`echo -e '\n\r'`VERSION: \1 \2 \3 \4\\`echo -e '\n\r'`/g" | tr -d "\r" | while read line; do
echo "$line"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment