Created
June 27, 2018 08:04
-
-
Save palashkulsh/e6721e65d76ba8dfc3dfeb828c9e4ea6 to your computer and use it in GitHub Desktop.
prepend the branch name in commit msg
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
put this file in .git/hooks/prepare-commit-msg file and run chmod 755 .git/hooks/prepare-commit-msg file . this prepends the branch name in the commit msg. it is useful when you have to mention jira id in every commit. then you can make a branch name with jira id in it and branch name would be prepended in every commit msg. | |
#!/bin/sh | |
BRANCH=`git branch | grep '^\*' | cut -b3-` | |
FILE=`cat "$1"` | |
echo "$BRANCH $FILE" > "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment