这为压缩多个提交提供了很好的解释:
http://git-scm.com/book/en/Git-Branching-Rebasing
但它不适用于已经推送的提交。如何在本地和远程回购中压缩最近的几次提交?
当我执行gitrebase-I origin/master ~4 master时,将第一个设置为pick,将其他三个设置为squash,然后退出(通过emacs中的c-x-c-c),我得到:
$ git rebase -i origin/master~4 master
# Not currently on any branch.
nothing to commit (working directory clean)
Could not apply 2f40e2c... Revert "issue 4427: bpf device permission change option added"
$ git rebase -i origin/master~4 master
Interactive rebase already started
其中2f40是选择提交。现在,4个提交都没有出现在git日志中。我希望我的编辑器重新启动,以便我可以输入一条提交消息。我做错了什么?