Last active
December 16, 2015 12:29
-
-
Save jmgarnier/5434874 to your computer and use it in GitHub Desktop.
Tired of typing the ticket number at the beginning of each commit msg? Git hooks to the rescue! From your current git project, edit the .git/hooks/prepare-commit-msg
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 | |
project="VCORE-" | |
ticket=$(git symbolic-ref HEAD | awk -F- '/VCORE-(.*)-/ {print $2}') | |
if [ -n "$ticket" ]; then | |
TEMP=`mktemp /tmp/commitmsg-XXXXX` | |
(echo "$project$ticket - "; cat $1) > $TEMP | |
cat $TEMP > $1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is my ruby (generic) version: https://github.com/mcmorgan/dotfiles/blob/master/.git-templates/hooks/prepare-commit-msg