Last active
December 31, 2015 13:29
-
-
Save kiela/7992960 to your computer and use it in GitHub Desktop.
Add branch name at the beginning of commit message if branch name starts with WEB or OP or SEC or FM
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 symbolic-ref HEAD | awk -F/ '{ if($3 ~ /^(WEB|OP|DEVOPS|SEC|FM|PS|DAT|AD)-[[:digit:]]/) print $3 }' | awk -F"_" '{ if($1) print $1 }') | |
if [ -n "$branch" ]; then | |
sed -i "1 s/^/$branch: /" $1 | |
sed -i '/'$branch\:'/a \\nIssue: https://acorns.atlassian.net/browse/'$branch $1 | |
fi |
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
wget https://gist.github.com/kiela/7992960/raw/f158458c63cca6ac413ea13abb6d0e643d0585f3/commit-msg -O .git/hooks/commit-msg && chmod +x .git/hooks/commit-msg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment