Skip to content

Instantly share code, notes, and snippets.

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 zorab47/299242 to your computer and use it in GitHub Desktop.
Save zorab47/299242 to your computer and use it in GitHub Desktop.
# Add the following lines to .git/hooks/prepare-commit-msg and
# ensure it is executable.
# Prefix the message with the branch's name e.g. "#STORY-23: "
# The reason the branch line is commented is to prevent accidental
# commits.
BRANCH=`git branch | grep '^*' | sed -e 's/^\* //'`
MESSAGE=`cat "$1"`
echo "#$BRANCH: $MESSAGE" > "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment