git change the parent branch

前端 未结 2 670
孤独总比滥情好
孤独总比滥情好 2021-01-28 12:16

The short story is : I have created Branch A out from the Develop Branch then I created Branch B From Branch A

2条回答
  •  孤独总比滥情好
    2021-01-28 12:56

    Let's say that your current branch diagram looks something like this:

    develop: A -- B
                   \
    branchA:        C -- D -- E
                               \
    branchB:                    F -- G
    

    You want the B branch to look like this:

    develop: A -- B
                   \
    branchB:        F -- G
    

    Rebase onto can be used here:

    git rebase --onto B E
    

    In plain English terms, the above command says to place the commit whose parent is E, which is the F commit (and the start of the B branch) onto a new base which is commit B in the develop branch.

提交回复
热议问题