简体   繁体   English

我没有从分支机构分支,而是从分支机构分支

[英]I didnt branch off of master, instead branched off of a branch

I have 3 branches, Master, B1, and B2. 我有3个分支,分别是Master,B1和B2。

Is it possible to rebase B2 back off of master, isntead of B1. 是否有可能将B2的基准从B1的主节点Isetad中退回。

I did a checkout on Master and was working in B1 to resolve things. 我在Master上进行了结帐,并正在B1中解决问题。 I did a second checkout, and thought it was off of Master, and resolved more bugs. 我进行了第二次结帐,并认为它不属于Master,并解决了更多错误。

Now I am in a scenario of Code Reviews and i see something like this. 现在我处于代码审查的场景中,我看到了类似的东西。 Master -> B1 -> B2 大师-> B1-> B2

and Both B1 and B2 are up for code review, so B2 contains B1s commits. 并且B1和B2都可以进行代码审查,因此B2包含B1的提交。

Is it possible to rebase B2 so it is off of Master such that it doesnt see B1's commit history? 是否可以重新设置B2的基准,使其脱离Master,使其看不到B1的提交历史?

I was not sure how to reset where it forked from or the best course of action to resolve it. 我不确定如何重设分支的位置或解决该问题的最佳方法。

Yes, you can do this with rebase: 是的,您可以使用rebase来做到这一点:

git checkout B2
git rebase --onto master B1

This will rebase the commits from B2 up to, but not including, the commit at the tip of B1 onto master . 这会将来自B2的提交重新部署,直到但不包括B1尖端的提交到master

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

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