Created
January 3, 2012 17:21
-
-
Save alexisbernard/1555896 to your computer and use it in GitHub Desktop.
Git hook to append Pivotal's story tag
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 | |
# File: .git/hooks/prepare-commit-msg | |
# Append the Pivotal's story tag at the end of the commit message. | |
# Your branch must be named like this: my_branch_12345. | |
story=$(git symbolic-ref HEAD|sed -rn 's/^.*_([[:digit:]]+)/\1/p') # -E instead of -r for Mac OS X | |
test $story && echo "[Story#$story]" >> $1 | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment