Created
May 31, 2012 06:54
-
-
Save patrikjohansson/2841551 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 | |
# Adds story/ticket number to original git commit template | |
# Add this file to .git/hooks/ | |
git_commit_file=$1 | |
temp=`mktemp /tmp/git-commit-message-XXXXXX` | |
story_number=`git branch | grep '^\*' | grep -o '[1-9][0-9]*$'` | |
if [ -n "$story_number" ]; then | |
(echo "\n[#$story_number]"; cat "$git_commit_file") > "$temp" | |
cat "$temp" > "$git_commit_file" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment