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.shfile from this gist at.git/hooks/prepare-commit-message(without.shextension).chmod +xit. - Name branches like
ECA-333/remove-all-shit-and-add-good-code. - Run
git config --global commit.template=~/.gitmessage. Placegitmessagefrom this gist at~/.gitmessage(don't forget the starting dot). - Use
git commitand wait for the editor, don'tgit commit -mor gitx shennanigans to utilize it. - This way
ECA-333will 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: