May 6, 2015 Recently, I have been working on a project with the Atlassian toolchain which includes: Jira (Issue Tracking), Stash (git), Bamboo (Continous Integration – build and deploy) and Confluence (Wiki). In Stash using the Yet Another Commit Checker plugin can ensure that every git commit messages pushed to the server has a valid Jira issue number. Configuring the plugin is simple, in this example the project uses the prefix ‘DS’, issue numbers will look like: DS-123, DS-145, DS-432. Now the responsibility is on the developer to make sure he adds that commit number. This can be tedious so I decided to try to automate it. First, I added a simple script to reject commits that do not have the correct issue number. Below is this first effort in .git/hooks/commit-msg. For more info on how git’s pre-commit hooks work see Customizing Git – Git Hooks View the code on Gist. This worked for a month until I was tired of typing in the issue number at all. In Jira and Stash, the branch names are standardized when you create the branch directly from the Jira ticket. For example, a feature for issue DS-215 would have branch name like feature/DS-215-cors. Fortunately, I work a smart co-worker and he wrote me 2 nice shell functions to strip the issue number out of the branch name. I revised my .git/hooks/commit-msg to look like this: View the code on Gist.