How do I link a merged-in PR to a Jira ?

agambrahma
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!
March 13, 2018

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

 

3 answers

2 accepted

4 votes
Answer accepted
Cooper Marcus
Contributor
June 14, 2021

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

Ciaran Sloan Fueled
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!
November 10, 2021

Works like a charm, thanks!

Guillermo Hurtado
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!
December 1, 2021

How do you edit the PR title after merged?, I'm unable to do it 

Cooper Marcus
Contributor
December 1, 2021

Hmm, might be a setting on your GitHub repo or org? On the PR's in my main repo, I see an "Edit" button next to the PR title - clicking it lets me edit the PR's title and description.

Chris Ellepola
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!
March 31, 2022

Yes this works great, thanks!

Ends up this is also in official docs:

Pull requests

Do at least one of the following:

- Include a commit in the pull request that has the issue key in the commit message. Note, the commit cannot be a merge commit.

- Include the issue key at the beginning of the pull request title.

- Ensure that the source branch name also includes the issue key at the beginning of the branch name.

Celine Hau
Contributor
June 25, 2023

cannot edit a merged PR title in bitbucket

Like # people like this
1 vote
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.
March 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

agambrahma
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!
March 14, 2018

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

Celine Hau
Contributor
June 25, 2023

thanks. what a horrible design. why anyone wants to use bitbucket is beyond me (we use it and everyone hates it)

0 votes
Marlon
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!
August 29, 2024

It definitely would be nice to be able to manually link a PR after the fact.

That being said, a little workaround can also be to add a web link:

  1. Click the dropdown arrow for the button titled "Link Issue"
  2. Click "Add web link
  3. Paste your link and add your link text
  4. That's it!

Shows a pretty nice link and includes the status of the PR as well. Then, like someone else mentioned, you can also leave a comment on the PR linking back to the ticket.

 

CleanShot 2024-08-29 at 13.38.32@2x.png

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events