Skip to content

Instantly share code, notes, and snippets.

@miguelramos
Created November 18, 2014 23:35
Show Gist options
  • Save miguelramos/a1a6f518430dda35f876 to your computer and use it in GitHub Desktop.
Save miguelramos/a1a6f518430dda35f876 to your computer and use it in GitHub Desktop.
Bash Script for Group git log and writes to CHANGELOG.MD
#!/bin/bash
AUTHOR=$(git config user.name)
DATE=$(date +%F)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
FILE="$DIR/CHANGELOG.MD"
echo "#CHANGELOG ON" $DATE > $FILE
git log --no-merges --format="%cd" --date=short --no-merges --author="$AUTHOR" --all | sort -u -r | while read DATE ; do
if [[ $NEXT != "" ]]
then
echo >> $FILE
echo "###" $NEXT >> $FILE
fi
GIT_PAGER=cat git log --no-merges --format=" - %s" --since=$DATE --until=$NEXT --author="$AUTHOR" --all >> $FILE
NEXT=$DATE
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment