我做得不好。我的工作流程看起来像这样:
git checkout master
# we're on master
git checkout -b feature/one
# now do work
git commit -a ...
# create a new feature branch
git checkout -b feature/two
# now do work
git commit -a ...
# oh shoot, I based my feature branch on another feature branch, not master!
基本上,我这样做了:
master: a---b------------
feature/one \-c--d------
feature/two \-e--f
而不是:
master: a---b------------
feature/one |-c--d-------
feature/two \-e--f-------
既然feature/two
存在并且在其中有有用的提交,我如何将其重新绑定以从feature/one
中排除提交并返回基于master
的内容?< / p>
答案 0 :(得分:3)
git rebase --onto master sha123~
其中sha123
是feature / two
我建议创建一个功能/二的重复分支来试一试,以确保没有任何中断