0r8cwg
Last Updated: February 25, 2016
·
317
· miguelmramos

Generate your changelogs with Git log and write

Generate a changelog group by date from your git log repo and writes to changelog.md file.

#!/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

GitHub gist.