假设A和B是 不 最近的提交,你有:
m--m (master) \ a--b--c--d--e--f (feature1)
由于feature1已被推送,因此重新定义它以重写其历史记录会有风险。
那你可以 恢复a - b 为了feature1来 不 显示这些变化:
git checkout feature1 git revert a^..b m--m (master) \ a--b--c--d--e--f--g (feature1)
然后,您可以从feature1创建feature2分支 樱桃挑选a - b 在上面:
git checkout -b feature2 git cherry-pick a^..b m--m (master) \ a--b--c--d--e--f--g (feature1) \ a'--b' (feature2)