Created
June 13, 2013 20:20
-
-
Save bronzehedwick/5776999 to your computer and use it in GitHub Desktop.
Git hook that inserts the current branch name in the commit title. Good for structures where the current branch = the ticket name. To install, rename this file to prepare-commit-msg and put it in .git/hooks.
This file contains hidden or 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 | |
ORIG_MSG_FILE="$1" | |
TEMP=`mktemp /tmp/git-XXXXX` | |
TICKET=`git rev-parse --abbrev-ref HEAD` | |
(echo $TICKET": "; cat "$ORIG_MSG_FILE") > "$TEMP" | |
cat "$TEMP" > "$ORIG_MSG_FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: this hook will fail on the first commit of a repo.