It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to link existing JIRA issue to a existing branch in Bitbucket

Peter Civitarese Jan 09, 2018

Hi,

Have been using JIRA/Confluence Cloud and Mercurial on separate server 

We have just moved to Bitbucket Cloud and linked to JIRA that is working ok.

Within an a JIRA issue, there is an option to create a "Branch" in Bitbucket. This appears to work fine for new branches moving forward and that it displays the link to the branch from within the JIRA issue.

How can you link an existing JIRA issue to an existing branch in Bitbucket so that within the JIRA issue it displays the link. Within the issue it only has the option to create a new branch, not link to an existing Branch.

Jiralink.png

Have search forums and have not come across an answer for this.

If this has been answered somewhere, can you show me the answer?

Thanks in advance

 

14 answers

10 accepted

7 votes
Answer accepted
Jobin Kuruvilla [Go2Group] Community Leader Jan 10, 2018

JIRA uses a simple technique to link issues and branches - You need to have the issue key in the branch name.

When you create a new branch, JIRA automatically adds the issue key in the branch name. Even if you create branches outside of JIRA with the issue key in it, they will appear in JIRA. But that also means that you cannot add existing branches unless you rename them to include the issue key.

Peter Civitarese Jan 10, 2018

Hi Jobin,

Thanks for reply. 

"When you create a new branch, JIRA automatically adds the issue key in the branch name. Even if you create branches outside of JIRA with the issue key in it, they will appear in JIRA."

We are aware of this. Our point was more linking existing Jira Issues to an existing branch that was already created.

 

"But that also means that you cannot add existing branches unless you rename them to include the issue key...."

We tried to preform this action to rename a branch to include the Issue Key, but was unable to to do this. Is this possible? if so how?

Our last option was to close the existing branch and recreate, or create another branch and merge. messy and one we were trying to avoid.

Peter

Jobin Kuruvilla [Go2Group] Community Leader Jan 10, 2018

There is no easy renaming of branching in git. I think the proffered way is to rename the local branch, delete the remote branch and then push the renamed branch.

In Bitbucket, you can probably create a new branch, with the new name, from the existing branch and delete the existing branch.

But yeah, no easy solution I am afraid, unless you add a plugin to do it in one click ;)

Peter Civitarese Jan 10, 2018

Ok, Could be improved as I'm sure I would not be the first to raise this type of question.

Thanks once again.....

Like # people like this
Zack Warburg Sep 26, 2018

I too would LOVE to see this...

Like # people like this
Saurabh Batra Oct 17, 2018

I would also like to see this.. being able to easily link jira and bitbucket branch is very much needed

Like Peter Civitarese likes this
Anatol Kastyka Oct 23, 2018

Vote for this enhancement

Like Peter Civitarese likes this
Olivier Vernin Oct 23, 2018

+1

Like # people like this
Cyndy Sumner Oct 26, 2018

I'd also like to see this.  It's likely that many JIRA users would already have existing repositories and branches.

Like # people like this
Clélia Lemaire Nov 07, 2018

+1

Like # people like this
Fernando Martinez Nov 08, 2018

+1

Like # people like this
Ramesh Natesan I'm New Here Nov 21, 2018

+1

Like Daniel Soares likes this
Arielle Adams Nov 21, 2018

+1

Like Daniel Soares likes this
Vincent Huijts Jan 16, 2019

+1

Alberto Blanque Jan 24, 2019

+1

Rodney Foley I'm New Here Apr 01, 2019 • edited Apr 03, 2019

How is this an "Accepted Answer" and flagged as SOLVED as it only explains how it currently works and not how to take an EXISTING bitbucket branch and link it to an EXISTING Jira issue.

The answer is YOU CANNOT and you are screwed if you want to do this until Atlassian actually implements this functionality.

This is a Q&A area so where is the feature request section of Atlassian to formalize this as a feature request that can be voted on?  As this is a community area that isn't probably monitored well by Atlassian for features.

Like Martin Kunz likes this
Martin Kunz Apr 03, 2019

Fully agree with above text. Waiting for a REAL solution since one year!!!

Like Rodney Foley likes this

Agreed. This would be very useful. +1

Dave Hollingshead 11 hours ago

Someone created an issue, say ABC-123, then a branch was created on a repo to solve the issue, also named ABC-123, yet on the Jira ticket, I only see Create Branch button, and I'm not seeing how to attach it to an existing branch on a certain repo.

Jira shows the repos and branches in the drop-downs, but it only lets me create a new branch even if an existing branch is exactly the same as the ticket ID.

Can someone explain this? Or how to attach the ticket to the branch?

Rodney Foley I'm New Here 10 hours ago

As stated previously in this question, it is not possible. You are screwed if you create the branch first. 

That is the point and problem with this question and Atlassian is ignoring the issues brought up here in the question.  The request is for a feature to allow connecting a branch regardless of its name and when it was created to a Jira issue. 

The safest and best way to link a bitbucket branch to a Jira issue is to use the link in the issue to create the branch which requires the issue to already exist and for a developer to think that you should create branches from issues and not from Git CLI or Git tool of choice. Alternative mentioned seems to name the branch the same as the issue exactly in a specific manner, however that may violate many branching naming conventions companies and teams already have in place.  However, using that link on the issue will name it this way also thereby violating the same conventions most likely as well.

For example, if you click the create branch link you get the following:

[IssueKey]-[issue-title-with-hyphans-all-lower]

FOO-42-this-is-an-issue-title-that-is-lo

It has a max length of 40 characters total so will be truncated and IMHO looks like crap.

Like Nicholas Zaleski likes this
5 votes
Answer accepted
Mallika Khullar Oct 29, 2018

+1

4 votes
Answer accepted
Martin Kunz Nov 16, 2018

Definetely would like to see this improvement/enhancement also. We have a lot of branches, which are not connected to our Jira-issues.

4 votes
Answer accepted
Nathan Pisarski Dec 21, 2018

I would absolutely love this feature. This is one of those features that I thought it was so simple that it wouldn't need to be specifically asked for.

Coming from Visual Studio Team Services (the bottom of the issue tracker food-chain), I thought this functionality was a base necessity. 

I don't like the idea of polluting the git history / branch list with a bunch of JIRA-specific stuff. It just feels like abusing Git for the sake of a third party. To make an analogy, it would be like if Skype used an IRC channel with special commands like `<emoji>100</emoji>` to transmit text. IRC communication should be plain-text just like git commits / branch names should be idiomatic for Git, NOT Jira.

3 votes
Answer accepted
Steve Hromyko Nov 16, 2018

+1

3 votes
Answer accepted
Alessandro Rivano I'm New Here Dec 21, 2018

+1 I would love this enhancement too! ... looooooooooot of Jira issues with no branch!

2 votes
Answer accepted
Saneesh S Sanal Dec 18, 2018

+1

2 votes
Answer accepted
Sandeep Guntupalli Feb 22, 2019 • edited

Would love to have this feature. Have experienced the frustration a tone of times.

1 vote
Answer accepted
Daniel Soares Jan 24, 2019

would like to see this improvement/enhancement also. We have a lot of branches, which are not connected to our Jira-issues.

1 vote
Answer accepted
Daniel Soares Jan 24, 2019
Peter Civitarese Jan 24, 2019

Hi Daniel,

Great to see the reference link for merging.

The link documentation is for JIRA server, we are on JIRA cloud. As we have experienced, there are some solutions for Server that can not be used on cloud and vice versa. If there is an equivalent reference for the cloud version, would be great to see it as suspect many others. I have not come across one yet.

Hint: @anyone at Atlassian listening.......

Cheers

Peter 

Daniel Soares Jan 28, 2019

Thank you. I will follow up with cloud customers in order to check if this solutions is applicable and I will search for a reference on Cloud.

1 vote
dburke Mar 13, 2019

+1

1 vote
Mark Gomez Apr 03, 2019

+1

0 votes
Nicholas Zaleski May 02, 2019

+1 

0 votes
Alexander Moreno I'm New Here May 02, 2019

+1

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Try Jira Cloud for Outlook: Organize your work without leaving your inbox

Hi Atlassian community, My name is Max and I work on the product integration team at Atlassian. I am pleased to announce the early access program for the Jira Cloud add-in for Outlook. This add-in...

1,196 views 2 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you