简体   繁体   English

如何创建一个从master恢复的新分支,然后在恢复后的新提交后使用该分支进行pull请求?

[英]How to make a new branch that is reverted from master, and then make pull requested with the branch after new commit after reversion?

Bascially, master is ABCDE.基本上,大师是ABCDE。 I would like to revert to C. So far, I have done git checkout -b revertedBranch <C's commit hash> .我想恢复到 C。到目前为止,我已经完成了git checkout -b revertedBranch <C's commit hash> I made a change, then commit and push the changes.我进行了更改,然后提交并推送更改。 Will I be able to create a pull request successfully?我能成功创建拉取请求吗? Essentially, it's going from Head to modified C. So, revertedBranch will look like CX.本质上,它是从 Head 到修改后的 C。所以,revertedBranch 看起来像 CX。 Then the pull request will try to get it to look like ABCDEX.然后拉取请求将尝试让它看起来像 ABCDEX。 Does that work?那样有用吗?

To answer to your question this will work.要回答您的问题,这将起作用。

As said by several people you should take care of the wording, you are not doing revert here, just forking from a previous commit.正如几个人所说,您应该注意措辞,您在这里没有进行恢复,只是从之前的提交中分叉。

So if you submit your pull request this can lead to:因此,如果您提交拉取请求,这可能会导致:

                ---X---   revertedBranch
              /         \
     A---B---C---D---E---Y--- master

Y will be the merge commit of your branch into master. Y 将是您的分支到 master 的合并提交。 Or if you set up git hub to rebase the PR:或者,如果您设置 git hub 来重新设置 PR:


     A---B---C---D---E---X'--- master

X' is the commit rebased on master X' 是基于 master 的提交

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM