Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can't reverse merge/undo commit

RobbieRobski
Contributor
August 1, 2019

I need to reverse a commit (merge) but I am getting an error in source tree and it's not working. Sadly I didn't catch a bug before merging so I need to go back.

The merge was done through bitbucket.org directly if that makes any difference.

I would reverse through bitbucket as well but I can't figure out if that's even a possibility.

In source tree, I  right clicked the commit and choose reverse comitt...

 

st-reverse.png

 

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks -c credential.helper= -c credential.helper="C:/Users/Rob~1/AppData/Local/ATLASS~1/SOURCE~1/GIT_EX~1/GIT-CR~2.EXE" revert --no-edit f455ba5dd935fd7a6a787e6271655e3aecb7965f
error: commit f455ba5dd935fd7a6a787e6271655e3aecb7965f is a merge but no -m option was given.
fatal: revert failed

Completed with errors, see above.

1 answer

0 votes
RobbieRobski
Contributor
August 1, 2019

I eventually found a revert button on the bitbucket website. I feel like I totally ham fisted the process. Reverting created a new branch, which I merged back into master.

Seems to have gotten the job done. Would it have been easier if I could have done it through Source Tree though?

Jimmy Seddon
Community Champion
August 6, 2019

Hi @RobbieRobski ,

I just edited your question and answer so that anyone coming here to look for a similar issue will be able to see how you resolved it.

As an additional note, merge commits are not the same as a regular commit which is why the error message states what it does ("no -m option was given.")

You might want to read more about how git revert works which can be done here:

https://git-scm.com/docs/git-revert#Documentation/git-revert.txt--mparent-number

I hope that helps!

-Jimmy

Karthick P (YCOMM)
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 17, 2020

@RobbieRobski Can you pass on the steps how did you achieved this in bitbucket cloud

Karthick P (YCOMM)
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 17, 2020

@Jimmy Seddon i had a look at the link it would be helpful if you provide me the script instead of generics as i am very new to git

Jimmy Seddon
Community Champion
March 17, 2020

@Karthick P (YCOMM) as someone who has screwed up many things using git revert I would strongly recommend that you don't use it to solve your issue.  revert is an advanced command that can cause a lot of damage if you don't understand exactly what you are doing.  For beginners, I'd recommend creating a new commit making exactly the changes that you would like to appear in the source code repository.

I hope that helps!

-Jimmy

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events