如何在Git中还原多个合并 [英] How to revert multiple merges in Git

查看:126
本文介绍了如何在Git中还原多个合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将分支还原到上一点。
如下图所示,分支具有多个提交和合并。
我需要将其恢复为修复提交。

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.

所以我尝试了:

git revert --no-commit fixingHashCode..HEAD

但它会引发错误:


错误:提交fixingHashCode是一个合并,但未提供-m选项。
致命:恢复失败

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

下一个我使用的

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

并再次报告错误:


错误:指定了主线,但未提交fixingHashCode合并。
致命:恢复失败

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

我该如何实现?

推荐答案

如果这是一个紧急问题,我想您可以。只需还原提交并在树上的HEAD上向后跳一个提交即可。

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

这篇关于如何在Git中还原多个合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆