Github恢复.不确定历史 [英] Github Revert. Unsure about history

查看:76
本文介绍了Github恢复.不确定历史的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事的项目有两个主要分支,即开发和掌握.我已经为我的功能分支设置了一个拉取请求,但由于错误地忘记了选择以开发为基础,因此PR是以master为默认设置(要更改它).

The project I'm working on has 2 main branches, develop and master. I had set up a pull request for my feature branch but by mistake forgot to choose develop as the base, and so the PR was for master as its default (going to change that).

由于被分配人没有意识到或认为是正确的,因此PR实际上已合并为master.然后我的分支被删除,PR关闭了.

The PR was actually merged into master as the assigned person either didn't realise or thought it was right. Then my branch was deleted and the PR closed.

过了一会儿,我意识到错误进入了错误的分支.在查看原始PR时,我注意到有一个还原按钮.因此,在与其他人进行阅读和交谈之后,我们执行了还原操作,该操作将进行一次新提交和一个新PR,以撤消原始PR所做的所有提交.

A little while later I had realised the mistake that it went into the wrong branch. When I looked at the original PR I noticed a revert button. So after some reading and speaking to another person we did the revert which makes one new commit and a new PR undoing all the commits made by the original PR.

然后将其合并,一切恢复正常.和错误合并之前一样.

That was then merged in and everything was back to normal. As before the mistake merge.

我恢复了原来的功能分支,并按照最初的意图进行了新的PR开发.但是,出于好奇,我选择了大师,看看Github怎么说. Github说我无法比较或合并,因为master包含所有提交作为我的功能分支.

I restored my original feature branch and made a new PR for develop as originally intended. However just out of curiosity I choose master to see what Github says. Github said that I could not compare or merge as master contains all the commits as my feature branch.

所以我的问题是.在适当的时候,如果我想在下周左右直接合并,我如何将自己的更改带入主服务器?

So my question is. When the time is right, how would I get my changes into master if i wanted to merge directly in next week or so?

或者,这就是我所困惑的,当我的功能按预期进行开发时,将要发生的事情/当将开发合并为主文件时它将如何工作?

Or, this is what I'm confused about more, when my feature goes into develop as intended, what is going to happen / how is it going to work when the time comes to merge develop into master?

请记住,master具有功能分支的所有提交,紧随其后的是来自temp分支的单个提交,该提交撤消了所有先前的合并更改.

Remember, master has all the commits of the feature branch followed straight after with a single commit from a temp branch which reversed all the previous merges changes.

推荐答案

据我了解,这是您现在遇到的情况:

As I understand it here's the situation you have right now:

  1. feature-branch已合并到master.
  2. feature-branch已合并到develop.
  3. 具有提交以还原feature-branch合并的提交的请求请求已合并到master.
  1. feature-branch has been merged into master.
  2. feature-branch has been merged into develop.
  3. A pull request that has a commit that reverts the feature-branch merge has been merged into master.

要在master中重新获得feature-branch更改,请创建一个新分支并创建一个提交以还原#3中的还原提交.通过拉取请求将此新分支合并到master.

To get the feature-branch changes back in master create a new branch and create a commit to revert the revert commit in #3. Merge this new branch into master via pull request.

最终结果是您将有两个合并请求合并到master中,而没有通过develop.我不知道这是否会破坏交易,但这很简单.

This end result is that you'll have two pull requests merged into master that didn't go through develop. I don't know if that's a deal-breaker but it's straightforward.

请参见此文章.

这篇关于Github恢复.不确定历史的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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