如何在交互式编辑期间从 vim 内部中止 git rebase [英] How to abort a git rebase from inside vim during interactive editing
问题描述
当我进行交互式 rebase 时,例如
When I do an interactive rebase, e.g.
git rebase -i HEAD~3
rebase 交互式编辑器(在我的例子中是 vim)打开让我编辑对 rebase 的提交
the rebase interactive editor (vim in my case) opens to let me edit the commits to rebase
pick c843ea2 Set Vim column limit to 80 (OS X)
pick fc32eac Add Bash alias for `pbcopy` (OS X)
....
如果我现在决定要中止变基并使用 :q
退出 vim,变基无论如何都会启动.我在 Windows 上使用 git 版本 1.9.0.msysgit.0
.
If I now decide that I want to abort the rebase and quit vim using :q
the rebase starts anyway. I'm using git version 1.9.0.msysgit.0
on windows.
当然,我可以删除所有 pick
行,但如果我重新设置更长的历史记录,可能会有很多事情要做.还有别的办法吗?
Sure I can just delete all pick
lines, but it might be a lot to do if I rebase a longer history. Is there another way?
如何退出 rebase 交互式编辑器 (vim) 并中止 rebase?
How can I quit the rebase interactive editor (vim) and abort the rebase?
推荐答案
如果退出编辑器并返回错误代码,rebase 将被中止.
If you exit the editor with an error code, the rebase will be aborted.
要在 vim 上以错误代码退出,请执行
To exit with an error code on vim, do
:cq
See here and vimdoc here.
这篇关于如何在交互式编辑期间从 vim 内部中止 git rebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!