Created
May 10, 2018 20:54
-
-
Save pbstriker38/7abf38121096e7983cd884eca741a83d to your computer and use it in GitHub Desktop.
Add JIRA ticket to commit message
This file contains hidden or 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_NAME=$(git symbolic-ref --short HEAD) | |
| TICKET_NUMBER=$(echo $BRANCH_NAME | egrep -o "[A-Z]+[_-]\d+$" | tr '_' '-') | |
| if [[ -n $TICKET_NUMBER ]]; then | |
| sed -i -e "1s/^/$TICKET_NUMBER /" $1 | |
| fi |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Place in
project_name/.git/hooksYou will probably need to run
chmod +x prepare-commit-msgto make it executable