Git - 在推送后恢复合并的所有提交 [英] Git - revert all commits of the merge after push

查看:95
本文介绍了Git - 在推送后恢复合并的所有提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下情况:

  master A  -  B  -  E 
/
second C - D - F

最好的解决方案是从主分支恢复所有提交'second branch' ?



'second'分支有大约70次提交。

解决方案

要恢复它,这很容易,提交E是第二个分支中所有提交的合并提交,该怎么做是删除E(合并提交),然后在master分支中,第二个分支中不会有更多的东西。


  1. git checkout master

  2. git reset --hard HEAD ^

然后就可以了。



第二个分支中的所有内容仍然保留。
对于master分支,第二分支没有更多的东西。

I have the following situation:

master A -  B -  E 
                / 
second   C -   D - F

What is the best solution to revert all commits of 'second branch' from master branch?

The 'second' branch has about 70 commits.

解决方案

To revert it, it is very easy, commit E is the merge commit from all commit in second branch, what to do is to delete the E (merge commit), then in master branch, there will be no more things from second branch.

  1. git checkout master
  2. git reset --hard HEAD^

Then it is ok.

Everything in second branch will still retain. For master branch, no more things from second branch.

这篇关于Git - 在推送后恢复合并的所有提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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