Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to have issue number on all commits when merging from a branch to master?

Joe L.
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 23, 2018

We are currently using the “Merge commit” strategy for pull requests.  When work for an issue starts, the branch is created from the Jira issue that it applies to.  When we complete the changes required for the issue on the branch and accept the pull request to master, the Jira issue number only appears on the single line for the merge commit, and the subsequent commits, on master, that came from that branch have no Jira issue number identified on them.  Is there a way to have the issue number tagged on each of the commits that come over from the branch?

1 answer

0 votes
Bryan Robison
Contributor
May 23, 2018

Jira and Bitbucket linking is established in the following ways:

  1. Jira issue key in the Branch name
  2. Jira issue key in the Commit message
  3. Jira issue key in the Pull Request title

If you want the commits within in a branch to be associated with a Jira issue then you need to include the Jira issue key in each commit message.

Joe L.
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 25, 2018

Thanks for the details Bryan.  Sounds like we'll have to put the issue key on each commit.  I was hoping for a Jira feature to be able to automatically apply the issue key based on the branch that was created by that exact issue.

Bryan Robison
Contributor
May 25, 2018

That would be a nice feature, but it's not the case. Feature branches are normally understood to be transient. Once you've merged the branch into develop or master it's not needed anymore and can be deleted. After deletion there's no branch to link back to the associated issue which is why including the issue key in the commit message is important.

Julius Davies [bit-booster.com]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 25, 2018

 

Commits are essentially immutable, especially after they've been merged into a mainline, and so such a feature would be awkward to implement.

The free add-on, Control Freak for Bitbucket Server, is a great way to force all commits to have JIRA references before they get merged.

(If I may so myself...)  ;-)

The add-on assumes you've properly linked your JIRA instance to your Bitbucket instance via the "Application Links" feature of both.

 

- Sylvie

(We maintain three add-ons:  1. Control Freak, 2. Git Graph for JIRA, 3. Rebase Squash Amend.)

 

p.s.  By the way, the 3rd one, Bit-Booster - Rebase Squash Amend, makes it really easy to quickly fix commits that are missing their JIRA reference - just hit the "Amend" button this plugin adds to the PR screen.)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events