-
-
Save vsshs/8a59b29e3b7e116b08d5 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 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") " in branch: $NAME" > "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment