Skip to content

Instantly share code, notes, and snippets.

@nddrylliog
Forked from alexisbernard/prepare-commit-msg
Created February 8, 2012 11:23
Show Gist options
  • Save nddrylliog/1768276 to your computer and use it in GitHub Desktop.
Save nddrylliog/1768276 to your computer and use it in GitHub Desktop.
Git hook to append Pivotal's story tag (prefix variant)
#!/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: 12345_my_branch.
story=$(git symbolic-ref HEAD|sed -r 's/^.*\/([0-9]+)_.*$/\1/') # -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