交互式 rebase (git rebase -i) 允许你重写、重新排序、合并、编辑或删除提交 — 在分享之前清理你的提交历史。它是从混乱的进行中工作提交制作干净、逻辑清晰历史的强大工具。
启动交互式 rebase
bash
git rebase -i HEAD~4 # interactively rebase the last 4 commits
git rebase -i <commit> # rebase commits after <commit>
# → opens an editor listing the commits with actions to apply
