Git 多个 commit 合并为一个 2026年5月24日 git 用 git rebase -i HEAD~N 进入交互模式,把后面的 commit 标记为 squash 或 s,保存后 Git 会合并成一个 commit。适合推代码前清理本地杂乱历史。