Created
August 9, 2015 22:40
-
-
Save 5470x3/37e0e40d1d4da6a4e175 to your computer and use it in GitHub Desktop.
.git/hooks/prepare-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 | |
BRANCHNAME=`git branch | grep '*' | grep "[A-Z]\+-[0-9]\+" | cut -d' ' -f2` | |
if [ $(cat $1 | grep -e "^${BRANCHNAME}">/dev/null;echo $?) -eq 0 ] ; then exit 0; | |
elif [ $(echo $2 | grep -e "^message">/dev/null; echo $?) -eq 0 -o $2=="" ]; then | |
mv $1 $1.tmp | |
echo ${BRANCHNAME}> $1 | |
cat $1.tmp >> $1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment