A.J
A.J

Reputation: 735

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

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

Does this solves?

topicA> git pull
topicA> git co topicB
topicB> git rebase topicA

I've looked into https://git-scm.com/docs/git-rebase but not saying this scenario. Looking into few other cases as well, but quite not sure how to proceed.

Upvotes: 0

Views: 34

Answers (1)

Daly
Daly

Reputation: 879

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:

                               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.

Upvotes: 2

Related Questions