Last active
August 29, 2015 14:01
-
-
Save leaysgur/2f46f37fcf3f6528f6b0 to your computer and use it in GitHub Desktop.
Add branch name to top of commit msg
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
#!/bin/sh | |
# Add branch name to top of commit msg. | |
# Save this as: .git/hooks/prepare-commit-msg | |
# And then: chmod +x .git/hooks/prepare-commit-msg | |
###################################################### | |
BRANCH=$(git branch | grep '*' | sed 's/* //') | |
( | |
mv $1 $1.BAK; | |
/bin/echo -n "#[${BRANCH}] " >$1; | |
/bin/echo "" >>$1; | |
cat >>$1; | |
)<$1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment