Skip to content

Instantly share code, notes, and snippets.

@yuki777
Created November 4, 2014 06:59
Show Gist options
  • Save yuki777/926a74186e6ee91309b5 to your computer and use it in GitHub Desktop.
Save yuki777/926a74186e6ee91309b5 to your computer and use it in GitHub Desktop.
.git/hooks/prepare-commit-msg
#!/bin/bash
file=$1
mode=$2
if [ "$mode" = "" ] || [ "$mode" = "message" ] ; then
branch=`git rev-parse --abbrev-ref HEAD`
if [ "$branch" != "master" ]; then
if [ "$branch" != "" ]; then
mv $file $file.tmp
echo -n "[#$branch] " > $file
cat $file.tmp >> $file
fi
fi
fi
@yuki777
Copy link
Author

yuki777 commented Nov 4, 2014

chmod 775 git/hooks/prepare-commit-msg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment