您好我有一个分支稳定包含其他分支的合并提交。结构如下:
提交历史记录:
Commit 1 - Branch 1 commit 1 ------------- Hash Code 1
Commit 2 - Branch 2 commit 1 ------------- Hash Code 2
Commit 3 - Branch 2 commit 2 ------------- Hash Code 3
Commit 4 - Branch 2 commit 3 ------------- Hash Code 4
Commit 5 - Branch 3 commit 1 ------------- Hash Code 5
分支1,2,3被删除并已与stable合并。有没有办法在提交历史中我可以压缩Commit 3和Commit 4。
期望的结果:
Commit 1 - Branch 1 commit 1 ------------- Hash Code 1
Commit 2 - Branch 2 commit 1 ------------- Hash Code 2
Commit 5 - Branch 3 commit 1 ------------- Hash Code 5
答案 0 :(得分:2)
您可以执行git rebase -i来执行交互式rebase。
git rebase -i HEAD~4
变化
pick commit 1
pick commit 2
pick commit 3
pick commit 1
进入这个
pick commit 1
s commit 2
s commit 3
pick commit 1
保存更改并执行git push -f