Created
May 23, 2014 15:20
-
-
Save tvervest/d62206dab9f8855644fe to your computer and use it in GitHub Desktop.
A git hook which appends a reference to a Pivotal Tracker story ID, if a branch starts with a number (e.g. "<story id>-my-issue")
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 | |
# Get the story ID from the branch name | |
story_id=`git symbolic-ref --short -q HEAD | grep -o "^[[:digit:]]*"` | |
if [ ! -z "$story_id" -a "$story_id" != " " ] | |
then | |
# If a story ID is found, prepend the commit message with a reference | |
echo "[#$story_id] $(cat $1)" > "$1" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment