Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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 do I link a merged-in PR to a Jira ? Edited

Hi all,

I'm new to Atlassian/Bitbucket/Jira, we use it at work and I'm loving it so far.

I now know that I should embed the Jira number in the branch name or PR title or commit description to link the two together but is there a way to do this for an older PR?

Basically, I had a Jira ticket "x", I had a PR "y" consisting of commit "z". I have already merged in "y", and didn't use "x" anywhere in the title of "y" or "z". Is there still a way to link these together?

 

Much thanks,

Agam

 

2 answers

2 accepted

0 votes
Answer accepted
Mikael Sandberg Community Leader Mar 13, 2018

Once you have merged a PR the only thing you can do is add the issue key as a comment in the PR, that will give you sort of a link where it allows you to click on the key and see the info from Jira, but it will not show the PR as related to the issue in Jira. You could revert the merge, recreate your change/s on a new branch and then created a new PR if you want. You cannot use the same branch for the new PR.

Reverting a regular commit just effectively undoes what that commit did, and is fairly straightforward. But reverting a merge commit also undoes the _data_ that the commit changed, but it does absolutely nothing to the effects on _history_ that the merge had.

So the merge will still exist, and it will still be seen as joining the two branches together, and future merges will see that merge as the last shared state - and the revert that reverted the merge brought in will not affect that at all.

So a "revert" undoes the data changes, but it's very much _not_ an "undo" in the sense that it doesn't undo the effects of a commit on the repository history.

So if you think of "revert" as "undo", then you're going to always miss this part of reverts. Yes, it undoes the data, but no, it doesn't undo history.

- Linus Torvalds

Thanks for the reply, I thought as much. Just adding the link works for now.

0 votes
Answer accepted

We have this issue sometimes - we simply edit the title of the merged PR to add the Jira issue(s) ID. That works well!

Suggest an answer

Log in or Sign up to answer
TAGS

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