简体   繁体   English

Git 从另一个分支创建分支时变基

[英]Git rebase when a branch is created from another branch

I have a precondition of:我有一个先决条件:

                        H---I---J topicB
                       /
              E---F---G---K---L  topicA
             /
A---B---C---D  master

And wanted to this state想要这个 state

                                H---I---J topicB
                                /
              E---F---G---K---L  topicA
             /
A---B---C---D  master

Does this solves?这解决了吗?

topicA> git pull话题A> git拉
topicA> git co topicB topicA> git co topicB
topicB> git rebase topicA主题B> git 变基主题A

I've looked into https://git-scm.com/docs/git-rebase but not saying this scenario.我调查了https://git-scm.com/docs/git-rebase但没有说这种情况。 Looking into few other cases as well, but quite not sure how to proceed.也调查了其他几个案例,但不确定如何进行。

The commands you have given are correct.您给出的命令是正确的。 It is important to note that rebasing changes the commit hashes in topicB , so the end result will look like this:重要的是要注意,变基会更改topicB中的提交哈希,因此最终结果将如下所示:

                               H'---I'---J' topicB
                                /
              E---F---G---K---L  topicA
             /
A---B---C---D  master

This doesn't effect any of the changes in topicB , just those commit hashes.这不会影响topicB中的任何更改,只会影响那些提交哈希。

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

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