主服务器上的Rebase功能分支,不包括以前的功能分支

时间:2015-07-06 21:43:08

标签: git

我做得不好。我的工作流程看起来像这样:

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>

1 个答案:

答案 0 :(得分:3)

git rebase --onto master sha123~

其中sha123是feature / two

中的第一个SHA

我建议创建一个功能/二的重复分支来试一试,以确保没有任何中断