Skip to content

Instantly share code, notes, and snippets.

@arnalyse
Created April 30, 2012 13:48
Show Gist options
  • Save arnalyse/2558504 to your computer and use it in GitHub Desktop.
Save arnalyse/2558504 to your computer and use it in GitHub Desktop.
Git: branch name pre-included in commit message
#!/bin/sh
/usr/bin/perl -pi -e \
'print `git symbolic-ref HEAD | sed -e "s|.*/\\(.*\\)|#[\\1] |"`
if $. == 1' \
"$1"
# copy this code into .git/hooks/prepare-commit-msg
# change the file permissions afterwards to 775
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment