我有一个看起来像这样的东西
6---7 (currentBranch)
/
3---4---5---8 (initialBranch)
/
1---2 (master)
我将 initialBranch merge 到 master 中,所以现在 master 看起来像这样
1---2---9 where commit '9' is commits 3+4+5+8 squashed together
我的最终目标是将远程仓库中的 currentBranch rebase 看起来像
6---7 (currentBranch)
/
1---2---9
完成此操作需要运行哪些命令系列?
最佳答案
如果原始 initialBranch
和 currentBranch
之间仍有提交“merge 基础”,即提交 5,则可以执行 rebase --onto
:
git rebase --onto master 5 currentBranch
这将在当前 master
之上重播第 5 次(即第 6 次和第 7 次)之后 的任何提交。
关于git - 如何使用压缩的提交进行 rebase ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69948930/