How to revert multiple merges in Git [duplicate]

半世苍凉 提交于 2020-07-08 22:49:27

问题


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.

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?


回答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.



来源:https://stackoverflow.com/questions/54119462/how-to-revert-multiple-merges-in-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!