Join the Stack Overflow Community
Stack Overflow is a community of 6.4 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

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?

share|improve this question
    
Would you prefer to use a different editor, such as Notepad? If so, I have a solution for that – Steven Penny Dec 1 '14 at 22:22
up vote 28 down vote accepted

You can use

:%d|x

to delete all lines, then save and quit

delete all lines of file in Vim

How to exit the VIM editor?

VIM - multiple commands on same line

share|improve this answer

If you want to exit vim with an error code, do

:cq

and it will abort the rebase. See here.

share|improve this answer
    
Less typing, same result – zposten Oct 18 at 12:23

If you're using Notepad++ on Windows for instance:

CtrlA to select everything, then Del or Backspace to delete and CtrlS save. Git will abort the rebase if the file is empty.

You may also hit CtrlC in the command prompt where git is running to stop the current rebase command. Then run git rebase --abort to revert it.

share|improve this answer

Delete all text in your text editor screen, then save the file with the default supplied path.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.