Skip to content

Instantly share code, notes, and snippets.

@alexisbernard
Created January 3, 2012 17:21
Show Gist options
  • Save alexisbernard/1555896 to your computer and use it in GitHub Desktop.
Save alexisbernard/1555896 to your computer and use it in GitHub Desktop.
Git hook to append Pivotal's story tag
#!/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