Skip to content

Instantly share code, notes, and snippets.

@AaronRustad
Created November 21, 2012 17:31
Show Gist options
  • Save AaronRustad/4126284 to your computer and use it in GitHub Desktop.
Save AaronRustad/4126284 to your computer and use it in GitHub Desktop.
.git/hooks/prepare-commit-msg
#!/bin/sh
ORIG_MSG_FILE="$1"
TEMP=`mktemp /tmp/git-XXXXX`
PIVOTAL_NUMBER=`git rev-parse --abbrev-ref HEAD | sed -ne 's/.*_\([0-9]*$\)/\1/p'`
if [ "$PIVOTAL_NUMBER" ]
then
(cat $ORIG_MSG_FILE; echo "[#$PIVOTAL_NUMBER]";) > "$TEMP"
cat "$TEMP" > "$ORIG_MSG_FILE"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment