它说:
当您保存并退出编辑器时,它会将您倒回到该列表中的最后一次提交,并将您放到命令行中,并显示以下消息:
$ git rebase -i HEAD~3
Stopped at 7482e0d... updated the gemspec to hopefully work better
You can amend the commit now, with
这并不意味着:
再次输入 git rebase -i HEAD~3
退出编辑器时尽量不要输入 ,它应该可以正常工作。
(否则,在您的特定情况下,可能需要重置所有内容并允许您重试)git rebase -i HEAD~3
git rebase -i --abort
正如Dave Vogt在评论中提到的那样,在您修改了第一个 commit 之后git rebase --continue
,用于在变基过程中执行下一个任务。
此外,Gregg Lind在他的回答中提到了以下reword
命令git rebase
:
通过将命令“pick”替换为命令“edit”,您可以git rebase
在应用该提交后告诉停止,以便您可以编辑文件和/或提交消息,修改提交,并继续变基。
如果您只想编辑提交的提交消息,请将命令 " pick
" 替换为命令 " reword
",因为Git1.6.6 (January 2010)。
它与 '<code>edit' 在交互式 rebase 期间执行的操作相同,只是它只允许您编辑提交消息而不将控制权返回给 shell。这是非常有用的。
目前,如果您想清理提交消息,您必须:
$ git rebase -i next
然后将所有提交设置为“编辑”。然后在每一个上:
# Change the message in your editor.
$ git commit --amend
$ git rebase --continue
使用 '<code>reword' 而不是 '<code>edit' 可以让您跳过git-commit
andgit-rebase
调用。