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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,412,245
Community Members
 
Community Events
169
Community Groups

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

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

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

Thanks for your complete answer smile

I understand now better how Bitbucket Server works now.

Thank you.

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?

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

Atlassian Community Events