本文介绍了git rebase:复制而不是移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的分行是:

  code>制作了重新印制的副本。所以在你的例子中

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

给您带来
<$ p $ (修补程序/ A')
/
o --- o support.2013.16
\
o --- o --- o --- o --- o master
\
o --- o --- o修补程序/ A


My branches are:

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

I need to copy hotfix/A to support.2013.16. I'm aware of cherry-picking, but is it possible to do something like

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

but without moving a branch but copying it instead?

解决方案

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

这篇关于git rebase:复制而不是移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 20:12