3 回答

TA贡献1906条经验 获得超10个赞
这是一个典型的案例rebase --onto:
# let's go to current master (X, where quickfix2 should begin)
git checkout master
# replay every commit *after* quickfix1 up to quickfix2 HEAD.
git rebase --onto master quickfix1 quickfix2
所以你应该从
o-o-X (master HEAD)
\
q1a--q1b (quickfix1 HEAD)
\
q2a--q2b (quickfix2 HEAD)
至:
q2a'--q2b' (new quickfix2 HEAD)
/
o-o-X (master HEAD)
\
q1a--q1b (quickfix1 HEAD)
最好在干净的工作树上完成。
请参见git config --global rebase.autostash true,尤其是在Git 2.10之后。

TA贡献1818条经验 获得超7个赞
您可以git cherry-pick
用来仅选择要复制的提交。
最好的方法可能是在master之外创建分支,然后在该分支中使用git cherry-pick
所需的quickfix2的2次提交。

TA贡献1802条经验 获得超5个赞
您可以做的最简单的事情就是挑选一个范围。它的功能与相同,rebase --onto但对眼睛更容易:)
git cherry-pick quickfix1..quickfix2
- 3 回答
- 0 关注
- 514 浏览
添加回答
举报