Skip to content

Instantly share code, notes, and snippets.

@DiogoCercilio
Created August 31, 2017 19:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DiogoCercilio/478ba99d2fb28a941260dbcb35c66556 to your computer and use it in GitHub Desktop.
Save DiogoCercilio/478ba99d2fb28a941260dbcb35c66556 to your computer and use it in GitHub Desktop.
Add branch name to commit message
// Go to ".git/hooks/prepare-commit-msg.sample", and rename this file to "prepare-commit-msg".
Insert the code below:
NAME=$(git branch | grep '*' | sed 's/* //')
echo "[$NAME] -" $(cat "$1") > "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment