What links a JIRA issue to Bitbucket commits/PRs

Edward Basiliere August 23, 2017

Hello,

We are using the server versions of both JIRA and Bitbucket. When I view JIRA project releases I can view issues belonging to that release. The Development column shows commits and the merge status of pull requestsl linking to those tickets. 

I see commits linked from having the JIRA issue ID in the commit message. What else creates this link? Branches with a JIRA issue ID in the name? Anything else?

Thanks!

2 answers

1 accepted

6 votes
Answer accepted
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 23, 2017

JIRA issues are linked when you mention the JIRA key in Bitbucket, either in the branch name, as part of the description or comment in a pull request or as part of the commit comment (as you have seen). 

Here is some more information about the integration, https://confluence.atlassian.com/bitbucketserver/jira-integration-776639874.html

Edward Basiliere August 24, 2017

Perfect. Thank you!

Edward Basiliere August 24, 2017

Do user forks not apply?

I committed to a user repo under my account, which displayed the commit fine in the Development area in the JIRA issue.

When I attempted the same in a forked repo under my account, the commit did not display in the JIRA issue.

I also tested with a fork that is under a project, not a user account, and that displays fine.

Thanks.

Ben Taylor August 6, 2019

I've run into this just now, I find that issues are linked in the Bitbucket PR if I mention the JIRA ticket in the git branch name or in the git commit message, but they if I mention them in the PR description or in a comment then the text is hyperlinked but the ticket number does not appear at the top as a linked ticket. This doesn't seem to be the expected behaviour, going by the answer above?

Like # people like this
Stanislav German-Evtushenko October 1, 2019

Automatic linking with a JIRA ticket by mentioning the key in a commit doesn't work for me either (though it used to work in the hosted Bitbucket). Has anything changed since then?

Like # people like this
Jaque_Johansen March 9, 2020

It doesn't work for me either, but it may because I am using the free versions, I do not know for certain.

jason.thorne12 November 24, 2020

Auto linking of the commit message to the jira works, but the commit message is not showing up in the jira task. Breeze does this much better

https://www.breeze.pm/

Come on atlassian, lift your game

ChuckieAJ
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.
December 11, 2020

What about when you have already done several commits in a new branch. And THEN decide to create a Jira issue?

it is not easy to modify all my existing commits to have the Jira issue ID. 

Markos Hudson April 21, 2021

@ChuckieAJ try adding the ticket number in the PR title. Or, if need be, it always works to manually add a weblink to the Jira ticket, containing the URL of the PR.

Brian Catagnus March 10, 2022

I have been able to associate a Jira ticket with bitbucket branches, commits and PRs by using the suggested method.

What I don't understand is when my branch already has the issue key at the head of the name and is linked to Jira, when creating a PR I also need to remember to mention it in the PR description?

This seems counter intuitive as the main purpose of automation is to help mitigate errors made by people. If I create the branch from the Jira issue then after that, all commits and PRs should be linked to the issue.

Am I missing something? Does it not look at the branch to see if it is linked to an issue?

Do we expect every developer to remember to add that key every commit and every PR?

Like # people like this
0 votes
John Bain December 13, 2022

@Mikael Sandberg - This is a broken, and not thoroughly considered solution from my perspective, which is causing massive issues when creating Jira filter queries based on pr status (especially bad when releasing). Here's the main problem with this design: By default, Jira branch names include the issue key, and by default the BitBucket pull request commit message includes the branch name. So, we have Jira issues with branches, and pull requests created from them, then merged and closed, now showing up on other unrelated Jira issues, because any branch off of develop which "refreshes" from the main integration branch (develop), will then pick up those merge commits which contain the Jira Issue ID/branch name, causing a closed ticket in Jira to show open pull requests, and additional branches associated with it, even if that isn't the case. I'm thinking the most complicated manner to fix this issue is to require either a rebase when "refreshing" from develop (rebasing, though sometimes a very useful strategy, is absurdly complex when you have a monolithic codebase of over 8 million LOC, and over 200+ developers). I wish instead that the default bitbucket branch commit history, which I'm assuming is what is being implemented by the REST caller from Jira to BitBucket, instead used a default --first-parent, or even a git log HEAD ^develop type of filter so as not to include all the commits which have occurred on the integration branch. If there is some configuration setting to avoid this, I would love to know it. Please help, or at the very least, consider this a defect, and FIX IT. :-)

Jack Lippold September 28, 2023

Hear hear!

Suggest an answer

Log in or Sign up to answer