Created
December 29, 2017 13:44
-
-
Save peterdemin/a7b6825b2be70112d54ffcad695465da to your computer and use it in GitHub Desktop.
Git commit-msg hook, that adds Jira ticket number from branch name to each commit message
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 | |
ticket=$(git symbolic-ref HEAD | grep -o 'ND-[0-9][0-9]*') | |
if [ -n "${ticket}" ]; then | |
grep -qs "^ *${ticket}" "${1}" || (echo >> "${1}" && echo "${ticket}" >> "${1}") | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This one parses Jira ticket numbers in a form of
ND-<number>
. Adapt to your needs