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

is there a way to undo/revert a revert?

Yes, you read that correctly :). Hope this makes sense, so here's what happened:


I merged my working branch into master, per usual. My internet dropped midway through the merge and my local/working branch corrupted (workspace integrity issues). As I was trying to debug and figure out how to fix, I came across the "Revert" button on Bitbucket. So, I clicked it to see if that would solve my problem.

What I saw was that it would create a new PR "called revert pr #" which looks like it selects the previous commit (or undos the most previous commit) and merges that back into master. logically, that's fine and worked as it should.

however, I realized that actually didn't solve my workspace integrity issue, and I had to do some other stuff to fix that. once I fixed the workspace issue, I wanted to re-try merging the original PR (PR #53), but it still says "revert". I suspect that this doesn't actually "revert my revert" and instead repeats the process of creating a new PR, etc.  Screen Shot 2018-06-15 at 6.56.28 AM.png

so rather than trying that, i tried to go back to the branch that the original PR was created for and create another PR for it. but, it's not working. despite the working branch being different from the master, it doesn't seem to let me create a new PR as it said something to the effect of "there are no changes in this branch from the master branch". so i artificially forced those changes by deleting a few comments, etc., hoping that would do something to no avail.


so now, I'm trying to figure out how to revert back my master to pre PR#53 being merged and also recreating PR #53 so that I can merge in the working branch into my master.


I hope that makes sense?

2 answers

1 vote
Mikael Sandberg Community Leader Jun 15, 2018

Hi Elias,

It is possible to have you changes added back to your master branch, but there are a couple of things you need to do.

Linus Torvalds explains the situation (

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.

So in order to get your changes back into master, you need to do this:

  1. Checkout the branch you want to merge back
  2. Create a new branch that will be used to replay your commits made on the original branch
  3. Locate the parent commit from which your original branch was created from, you can use git log --graph --oneline --all to find it
  4. Run git rebase --no-ff <parent commit from above> to rebase your new branch to replay your commits.
  5. Merge your new branch into master via a pull request.

Hi Mikael - Thanks for the response.

I followed the steps you outlined, but as I'm trying to merge the newly created branch (SAP107v2) that I created from my original branch (SAP107) into master via the PR, it's still not reading the changes.

So in both SAP107 & SAP107V2, there are 3 files that I changed. And master (both remote and local working) don't have these changes (obviously), yet the PR isn't seeing the difference beyond a line that i commented out to force a new commit.

What am I doing something wrong? I almost feel like I should just "force push" this SAP107 or SAP107V2 to master and overwrite it since technically it has everything that I need.

Mikael Sandberg Community Leader Jun 15, 2018

It almost sounds like the new branch was not rebased correctly. A force push should do it too.

EDIT (wrong place to put mi initial question):


Hello, how exactly do you find the parent commit from where you branch was created?

I run the commando but I don't know how to interpretate the output

Mikael, thanks a bunch for this solution.

I am in the same situation 2.5 years later and it seems that the --no-ff option was deprecated and removed from git in the meantime. I find no trace of it anymore. I will try to figure it out on my own, but if you have any Idea I appreciate every input.

Kind regards


Hello, how exactly do you find the parent commit from where you branch was created?

I run the commando but I don't know how to interpretate the output

Mikael Sandberg Community Leader Feb 19, 2019

@elninjagaiden you basically have to follow the lines in the output and try and figure out which of the commits is the parent one. If you only have one commit on the branch it is simple, if you have many it will take some detective work. Example:

Lets say I want to find the parent commit for bugfix/SB-60-user-scenarios-demo. If you do it from the command line, you can see it is not that easy to find it. The top screenshot is from within Sourcetree and it makes it easier to find the parent.


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,930 views 10 16
Read article

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