How to revert multiple merges in Git [duplicate]
Asked Answered
H

1

4

I need to revert a branch to a previous point. As you can see in the following picture the branch has multiple commits and merges done. I need to revert this to the "fixing" commit.

branch history

So i tried:

git revert --no-commit fixingHashCode..HEAD

but the it throws an error:

error: commit fixingHashCode is a merge but no -m option was given. fatal: revert failed

Next i used:

git revert --no-commit fixingHashCode..HEAD -m 3

And a error was reported again:

error: mainline was specified but commit fixingHashCode is not a merge. fatal: revert failed

How can i acheive this?

Herpetology answered 9/1, 2019 at 22:42 Comment(2)
Do you want to add one or more new commits that undo the changes since fixing, or do you want to change the history, pretending that all the red and blue commits never existed? (Since the history is already published, changing it would not be a good idea.)Crisper
@Crisper I want undo the commits ands mergers, not erase the wrong commits if possibleNiela
A
-1

If it's an urgent question I guess you can.just revert the commits and jump one commit backwards on HEAD on the tree.

Alvira answered 9/1, 2019 at 22:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.