git rebase: copy instead of moving

后端 未结 2 816
南笙
南笙 2021-02-12 00:59

My branches are:

o---o  support.2013.16
     \\
      o---o---o---o---o  master
                       \\
                        o---o---o  hotfix/A
         


        
2条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-12 01:22

    Git rebase really does copy the original branch to a new one; but because it moves the branch head, it feels like a move rather than a copy. If you used git branch to add an additional branch head to the original branch, you would still have easy access to the original branch after git rebase had made the rebased copy. So in your example

    git branch rebased-A hotfix/A
    git rebase --onto support.2013.16 master rebased-A
    

    leaves you with

          o---o---o  rebased-A (hotfix/A')
         /
    o---o  support.2013.16
         \
          o---o---o---o---o  master
                           \
                            o---o---o  hotfix/A
    

提交回复
热议问题