git rebase:复制而不是移动 [英] git rebase: copy instead of moving
问题描述
我的分行是:
o --- o support.2013.16
\
o --- o --- o --- o --- o master
\
o --- o --- o hotfix / A
我需要将hotfix / A复制到support.2013.16。我知道樱桃采摘,但是有可能做一些像
git rebase --onto support.2013.16 master hotfix / A
但没有移动分支,而是复制它?
Git
rebase
真的会将原始分支复制到一个新的分支上;但因为它移动了分支头部,所以感觉就像是一个动作而不是副本。如果您使用 git branch
将额外的分支头添加到原始分支,您仍然可以轻松访问 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:复制而不是移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!