The problem: you want JIRA ticket number in commit descriptions and possibly in the PRs. The solution: automate it.
Setup and usage:
- In the repository place the
prepare-commit-message.sh
file from this gist at.git/hooks/prepare-commit-message
(without.sh
extension).chmod +x
it. - Name branches like
ECA-333/remove-all-shit-and-add-good-code
. - Run
git config --global commit.template=~/.gitmessage
. Placegitmessage
from this gist at~/.gitmessage
(don't forget the starting dot). - Use
git commit
and wait for the editor, don'tgit commit -m
or gitx shennanigans to utilize it. - This way
ECA-333
will be grabbed out and used: (A) in the commit header and (B) below the commit description, formatted markdown-ready as a link to our JIRA. Example commit message: