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

Is it possible to delete a merged pull request in Bitbucket?

Veena Kamath February 4, 2019

Hi,

I have 3 branches in my working repo : master, A and B. I intended to create a pull request from B to A, but accidentally created the pull request from B to master and merged.

The pull request contains commits B1, B2 and B3 (actually there were many commits in the pull request which is difficult to handpick). Before the pull request merge, the master was at commit M1. If I look at the commit history in master now, i see the following:

 - merge commit ID

 - B1

 - M1

 - B2

 - B3

I want to reset the master branch to the M1 commit with all the commits included in the pull request being deleted. Is this possible?

 

Appreciate your help!

Thanks,

Veena

1 answer

0 votes
Jobin Kuruvilla [Adaptavist]
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.
February 4, 2019

A merge creates a new commit on master. In order to revert those changes, you can use "git revert" on that merge commit.

https://mijingo.com/blog/reverting-a-git-merge has a good example.

Also, keep in mind that the revert also creates another commit. You can merge it back by reverting the revert!

Veena Kamath February 4, 2019

Thanks Jobin.

I was using sourcetree and did Reverse commit (I think this is same as git revert command). I got some error saying that was a merge commit.

I did a reset to the to the previous commit (M1) and did force push. This deleted all the commits associated with the merge and retained all previous the commits pushed to master.

Thanks for your help

-Veena

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events