Skip to content

Instantly share code, notes, and snippets.

@albburtsev
Created October 10, 2013 12:15
Show Gist options
  • Save albburtsev/6917386 to your computer and use it in GitHub Desktop.
Save albburtsev/6917386 to your computer and use it in GitHub Desktop.
❯ cat .git/hooks/prepare-commit-msg
#!/bin/bash
b=`git symbolic-ref HEAD| sed -e 's|^refs/heads/||' | sed -e 's|_.*||'`
c=`cat $1`
if [ -n "$b" ] && [[ "$c" != "[$b]:"* ]]
then
echo "[$b]: $c" > $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment