The prepare commit msg hook script of git, Add issue number to commit message when branch name starts with "Fix"
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 | |
if [ -n "$1" ] | |
then | |
mv $1 $1.tmp | |
issue_branch=$(git branch | cat | grep "*" | awk '{print $2}' | cut -c 1-3); | |
if [ $issue_branch="Fix" ] | |
then | |
issue_num=$(git branch | cat | grep "*" | awk '{print $2}' | cut -c 4-); | |
echo "[$issue_num]: " > $1; | |
cat $1.tmp >> $1; | |
rm $1.tmp; | |
fi | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment