我有以下 Git 存储库拓扑结构:
A-B-F (master)
\ D (feature-a)
\ /
C (feature)
\
E (feature-b)
通过 rebase feature
分支,我希望对整个子树(包括子分支)进行 rebase :
$ 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)
我知道我可以通过执行以下命令轻松地手动修复它:
$ git rebase --onto feature C feature-a
$ git rebase --onto feature C feature-b
但是有没有办法自动 rebase 分支,包括它的所有子/后代?
最佳答案
git branch --format='%(refname:short)' --contains C | \
xargs -n 1 \
git rebase --committer-date-is-author-date --onto F C^
关于git - 重新设置一个分支,包括它的所有子分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5600659/