以修改最近两次历史提交为例:
1、git rebase -i HEAD~2
2、如果修改第2个历史提交,将pick改为e,wq保存并退出
3、会出现下面的提示,这儿的意思是一个一个得修改,从最靠前的那一个开始
You can amend the commit now, with
git commit --amend
Once you are satisfied with your changes, run
git rebase --continue
4、git commit --amend
会将第2个修改message显示出来,测试可以修改commit message,修改完后,wq保存退出
5、git rebase --continue
这一步必需执行,这个说明继续执行修改操作
6、出现下面的内容,说明修改完毕,此次修改历史记录的操作完成
work$ git rebase --continue
Successfully rebased and updated refs/heads/some.