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...
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.
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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@RobbieRobski Can you pass on the steps how did you achieved this in bitbucket cloud
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.