Git还原合并合并 [英] Git Revert a Revert for a Merge

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

问题描述

我创建了一个功能分支,比方说github上的feature/branch1. 我为此创建了一个拉取请求并将其合并.

I had a feature branch created, let's say feature/branch1 on github. I created a pull request for it and got it merged.

当它到达我们的管道时,我们发现存在问题,并使用Gi​​t上的还原"按钮将其还原 这创建了一个还原" PR,我们与母版合并,一切都很好.

When it reached our pipeline, we figured there was a problem and we got it reverted using the Revert button on Git This created a "Revert" PR that we merged with the master and all was well.

几周后,发布其他已合并到母版中的PR,我们认为我们会还原-还原.这次,我们进入了已关闭的还原PR",并尝试再次使用还原"按钮.但是我们收到了此错误消息

After a few weeks, post other PRs that got merged into the master, we figured we would revert-the-revert. This time, we went into the Revert PR that was closed and tried to use the Revert button again. But we got this error message

Sorry, this pull request couldn't be reverted automatically. 
It may have already been reverted, or the content may have changed since it was merged.

如何完成此还原?

我想拥有的最理想的情况是拥有一个包含 revert of revert 的新分支,以便我可以进行进一步的更改并返回PR过程.

The most ideal situation I would like to have, is to have a new branch that contains the revert of the revert, so I can make further changes and go back through the PR process.

推荐答案

您看到的错误是对github的人工检查,我个人认为不需要.您可以在本地还原还原,然后:

The error which you see is artificial check of github, which I personally find unneeded. You can revert the revert locally then:

git fetch origin master
git checkout origin/master (or reset)
git revert <REVERT HASH>
git push origin master

这应该成功,与自还原以来所做的更改发生模冲突.

This should succeed, modulo conflicts with changes done since the revert.

PS:实际上,该错误可能是由于冲突造成的.

PS: actually, the error could be because of the conflicts.

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

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