重新定位一个分支,包括它的所有子节点 [英] Rebasing a branch including all its children
本文介绍了重新定位一个分支,包括它的所有子节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下 Git 存储库拓扑:
I have the following Git repository topology:
A-B-F (master)
D (feature-a)
/
C (feature)
E (feature-b)
通过重新定位 feature
分支,我希望重新定位整个子树(包括子分支):
By rebasing feature
branch I expected to rebase the whole subtree (including child branches):
$ git rebase feature master
A-B-F (master)
D (feature-a)
/
C (feature)
E (feature-b)
然而,这是实际结果:
C' (feature)
/
A-B-F (master)
D (feature-a)
/
C
E (feature-b)
我知道我可以通过执行以下操作轻松手动修复它:
I know I can easily fix it manually by executing:
$ git rebase --onto feature C feature-a
$ git rebase --onto feature C feature-b
但是有没有办法让分支自动变基,包括它的所有孩子/后代?
But is there a way to automatically rebase branch including all its children/descendants?
推荐答案
git branch --format='%(refname:short)' --contains C |
xargs -n 1
git rebase --committer-date-is-author-date --onto F C^
这篇关于重新定位一个分支,包括它的所有子节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文