Skip to content

Instantly share code, notes, and snippets.

@tvervest
Created May 23, 2014 15:20
Show Gist options
  • Save tvervest/d62206dab9f8855644fe to your computer and use it in GitHub Desktop.
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")
#!/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