Skip to content

Instantly share code, notes, and snippets.

@berryp
Forked from alfredodeza/prepare-commit-msg
Created May 28, 2013 21:43
Show Gist options
  • Save berryp/5666391 to your computer and use it in GitHub Desktop.
Save berryp/5666391 to your computer and use it in GitHub Desktop.
#!/bin/sh
# this file should be marked as executable and placed on .git/hooks/
BRANCH_NAME=$(git branch 2>/dev/null | grep -e ^* | tr -d ' *')
if [ -n "$BRANCH_NAME" ] && [ "$BRANCH_NAME" != "master" ] && [ "$BRANCH_NAME" != "(nobranch)" ]; then
echo "#$BRANCH_NAME $(cat $1)" > $1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment