How to remove a JIRA issue associated to my Bitbucket Server Pull Request

Nicolas Mivielle July 27, 2016

Hi,

Since I made a mistake and I take the wrong 'JIRA issue' in my Pull Request creation, I need to remove the current association to replace by another JIRA issue. It seems there's is no possibility to de-associate any JIRA issue when you use its name in commit or PR message when working with Bitbucket. Once the JIRA is associated, all JIRA developement panel can't be updated to new one and the PR detail view in Bitbucket Server can't also modify this association.

Is someone has a solution for that? (without deleting all my PR smile) 

Thank you.

 

5 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
G__Sylvie_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.
July 27, 2016

tl;dr version:  rewrite the history on your "personal" branch to fix up the bad commit message, and then "push -f" that version of the branch (force push).  The PR will automatically pick up the rewritten branch.

---

Here's one way to do that: 

I would run an interactive rebase on your personal branch to rewrite the bad commit message, and then force-push the updated branch to your Bitbucket Server.    Your "branch permissions" config for the repo would need to allow history rewriting on the "personal" branch for this to work.  Here are the exact commands I would run from git cli:

# WARNING: "git branch -d" deletes local "personal" branch.
# Make sure there's no uncommitted or unpushed work you don't mind losing!

git branch -d personal

git fetch -p
git checkout personal
git rebase -i HEAD~4   (to edit commit messages of last 4 commits)



This fires up an editor for the "interactive rebase".   Mark the commit that needs a new message with "reword" and leave all the others with "pick" (commits marked with "pick" are left alone).  Don't bother trying to edit commit messages in the editor, because it will have no effect during this phase of the process, and be careful not to rearrange the order of commits.  Save the rebase instructions.   Close the editor.  The rebase should proceed automatically the moment the editor is closed, which should cause a new editor to be launched for the commit message editing.  

Assuming the rebase fired up yet another editor window, now is the time to edit the bad commit message.  

Save your edited commit message.  Close the editor.  The rebase should then finish up.

Type "git log" to see if everything looks good.   If it does, type:

git push -f origin HEAD:personal

Your PR should be all good now!  smile

 

Note:  if your git's "push config" is set to "simple," then you can just type "git push -f" at this last step.  But I cannot in good faith recommend that unless YOUR ARE SURE your "push config" is set to "simple" because the result could be catastrophic if your "push config" is set to a different value.

 

p.s.  I'm the author of a Marketplace add-on:  Bit-Booster Commit Graph And More

0 votes
Nicolas Mivielle July 29, 2016

Thanks for your complete answer smile

I understand now better how Bitbucket Server works now.

Thank you.

0 votes
G__Sylvie_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.
July 27, 2016

Yes !  smile

0 votes
Nicolas Mivielle July 27, 2016

The FROM branch is personal branch TO a Master branch.

I have 6 commits on it, the wrong JIRA was associated on the 3rd commit. Other commits are correct.

Is this enough answer?

0 votes
G__Sylvie_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.
July 27, 2016

Can you include some specific details about your PR?   What is the "from" branch, what is the "to" branch, how many commits are on the "from" branch that aren't on the "to" branch (e.g., git fetch; git log origin/to..origin/from)?  And finally, how many commits reference the wrong JIRA issue, what branch are they on, and do the occur on the tip or before the tip of that branch?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events