Advertisement
Guest User

Prepend branch name to git commit messages

a guest
Nov 24th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.28 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Add this to .git/hooks/prepare-commit-msg
  4. # Prepends the current branch name to the git commit message
  5. TMPFILE=`mktemp /tmp/git-commit-msg.XXXXX`
  6. BRANCH=`git rev-parse --abbrev-ref HEAD`
  7. echo -n "$BRANCH " > $TMPFILE
  8. cat $1 >> $TMPFILE
  9. cat $TMPFILE > $1
  10. rm $TMPFILE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement