Created
February 9, 2015 18:20
-
-
Save manderly/18b0e0fab0198423615c to your computer and use it in GitHub Desktop.
Git hook: Automatically add branch name to the end of every commit message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Automatically adds branch name to the end of every commit message. Handy for git/JIRA integrations. | |
# Make a copy of .git/hooks/prepare-commit-msg.sample in your repo and name the file prepare-commit-msg (remove "sample" extension) | |
# Paste the following into the file, save the file, and try it out in bash | |
NAME=$(git branch | grep '*' | sed 's/* //') | |
echo $(cat "$1") "$NAME" > "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment