如何在交互式编辑器中中止git rebase [英] How to abort a git rebase in interactive editor

查看:155
本文介绍了如何在交互式编辑器中中止git rebase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我做一个交互式的rebase时,比如

  git rebase -i HEAD〜3 

rebase交互式编辑器(在我的例子中为vim)打开,让我编辑提交rebase

  pick c843ea2将Vim列限制设置为80(OS X)
pick fc32eac为`pbcopy`(OS X)
添加Bash别名... 。

如果我现在决定放弃rebase并使用:q 无论如何,rebase都会启动。我在Windows上使用git版本 1.9.0.msysgit.0



当然,我可以全部删除挑选这几行,但如果我重新设定较长的历史记录,这可能需要很多工作。有没有另一种方法?



如何退出rebase interactive editor(vim)并中止rebase?

解决方案

如果您退出vim并显示错误代码,它会中止rebase。
要以错误代码退出,请执行

 :cq 

请参阅此处和vimdoc 此处


When I do an interactive rebase, e.g.

git rebase -i HEAD~3

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)
....

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.

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?

How can I quit the rebase interactive editor (vim) and abort the rebase?

解决方案

If you exit vim with an error code, it will abort the rebase. To exit with an error code, do

:cq

See here and vimdoc here.

这篇关于如何在交互式编辑器中中止git rebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆