Created
March 20, 2019 10:17
-
-
Save coffman21/2bed0d1a6b0e5e5f0f0f4f2e075eb256 to your computer and use it in GitHub Desktop.
Git hook which adds branch name to commit
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 | |
BRANCH=$(git symbolic-ref --short HEAD) | |
COMMIT_MSG=$(cat $1) | |
if [[ $BRANCH == CPP-* ]] ; | |
then | |
echo "$BRANCH $COMMIT_MSG" > $1 | |
exit 0 | |
else | |
echo "$COMMIT_MSG" > $1 | |
exit 0 | |
fi | |
exit -1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment