Created
October 28, 2014 17:28
-
-
Save kentokento/750f0829eef5f712477a to your computer and use it in GitHub Desktop.
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 | |
if [ "$2" = "message" -o "$2" = "" ] ; then | |
msg="`cat .git/COMMIT_EDITMSG`" | |
branch=`git symbolic-ref HEAD 2>/dev/null` | |
if [ ! -n "`echo "$branch" | sed -e "s/.*\///g" | sed -e "s/[0-9]//g"`" ] ; then | |
header="`echo $branch | sed -e "s/.*\/\([0-9]\+\)$/PAIRS-\1/g"` " | |
if [ "$header" = " " ] ; then | |
echo "$msg" > $1 | |
else | |
echo "$header$msg" > $1 | |
fi | |
else | |
echo "$msg" > $1 | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment