Created
January 21, 2014 19:52
-
-
Save saghaulor/8547089 to your computer and use it in GitHub Desktop.
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 | |
# borrowed heavily from http://stackoverflow.com/a/17270862 | |
jiraNumber=$(git branch | grep '*' | egrep -io '[C][[:alpha:]][-[:digit:]]+') | |
firstLine=$(head -n1 $1) | |
if [ -z "$firstLine" ] ;then # Check that this is not an amend by checking that the first line is empty | |
sed -i "" "1s/^/$jiraNumber /" $1 # Insert branch name at the start of the commit message file | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment