Skip to content

Instantly share code, notes, and snippets.

@sadfuzzy
Last active August 29, 2015 14:04
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 sadfuzzy/a0efa7a9a7685c82da65 to your computer and use it in GitHub Desktop.
Save sadfuzzy/a0efa7a9a7685c82da65 to your computer and use it in GitHub Desktop.
Add branch name (and description) at the beginning of commit message
# Automatically adds branch name and description to every commit message.
#
DESCRIPTION=$(git config branch."$NAME".description)
if ! [[ $@ == *HEAD* ]] then
NAME=$(git branch | grep '*' | sed 's/* //')
echo "$NAME"': '"`cat "$1"`" > "$1"
fi
if [ -n "$DESCRIPTION" ] then
echo "" >> "$1"
echo $DESCRIPTION >> "$1"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment