Last active
August 29, 2015 13:57
-
-
Save jbueza/9352688 to your computer and use it in GitHub Desktop.
Adding more cats and wolves to the commit messages
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 | |
# | |
# Automatically add branch name and branch description to every commit message except merge commit. | |
# | |
COMMIT_EDITMSG=$1 | |
addBranchName() { | |
NAME=$(git branch | grep '*' | sed 's/* //') | |
DESCRIPTION=$(git config branch."$NAME".description) | |
echo "[$NAME]: :cat: :wolf: $(cat $COMMIT_EDITMSG) :cat: :wolf:" > $COMMIT_EDITMSG | |
if [ -n "$DESCRIPTION" ] | |
then | |
echo "" >> $COMMIT_EDITMSG | |
echo $DESCRIPTION >> $COMMIT_EDITMSG | |
fi | |
} | |
MERGE=$(cat $COMMIT_EDITMSG|grep -i 'merge'|wc -l) | |
if [ $MERGE -eq 0 ] ; then | |
addBranchName | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment