epcim
5/15/2017 - 10:04 PM

git config changelog notes

git config changelog notes

# https://harrow.io/blog/effortlessly-maintain-a-high-quality-change-log-with-little-known-git-tricks/

git config --global alias.changelog "notes --ref=changelog append"
git config --global alias.cl-bug "notes --ref=changelogs/bugs append"
git config --global alias.cl-feature "notes --ref=changelogs/features append"

git config --add remote.origin.push '+refs/notes/changelog:refs/notes/changelog`
git config --add remote.origin.fetch '+refs/notes/changelog:refs/notes/changelog`

# tags eq.
#git config --add remote.origin.push '+refs/notes/tags:refs/notes/tags`
#git config --add remote.origin.fetch '+refs/notes/tags:refs/notes/tags`

# example:
git changelog -m "- I'm an important note for the change log"

# print
git log --pretty="format:(%h) %N %an" --show-notes=*

# if git [cl-bug|cl-feature] is used
GIT_NOTES_REF=refs/notes/changelogs/* git log --pretty=format:%N | markdown

#!/bin/sh
for rev in $(git rev-list HEAD); do
  if git notes --ref=changelog list $rev &> /dev/null; then
    git notes --ref=changelog show $rev
  fi
done