Last active
August 29, 2015 14:01
-
-
Save asabirov/9f40e3d280ee7ad633db to your computer and use it in GitHub Desktop.
Git hook which appends current branch name to commit message (.git/hooks/prepare-commit-msg)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
CURRENT=`grep -e "^[^#]" $1` | |
if [ -z "$CURRENT" ] | |
then | |
NEW_MSG=$(echo "$BRANCH"; cat "$1") | |
echo "$NEW_MSG" > $1 | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment