Jira ticket number in Git commit

Just like many developers these days, I often find myself working on a project where we use Jira to track our work and progress. When using Jira and Bitbucket to to track source code that lives in Git repositories, it can be very convenient to write the Jira ticket id’s in the Git commit messages. This way both Bitbucket and Jira will pick it up and display everything neatly together.

However, writing the Jira ticket in every commit message can become quite the challenge. I for one always forget to add it. So I wrote an npm package, called magik-commit, to do it for me.

It’s pretty simple. When creating a new Git branch, make sure that the ticket number is part of the branch name. This can be easily accomplished by using the “create branch” button from Jira. This is only available when using Jira in conjunction with Bitbucket though. So, if you’re not using Bitbucket, just create the branch name like this:


After installing the module via npm, every commit message you create will be prepended with the Jira ticket id, `JIRA-42` in this case.

This will also work when using other issue trackers, as long as your ticket id’s are in the format recognised by magik-commit. Have a look at the magik-commit on npmjs.org for more information.