How to abort git reboot in interactive editor

When I do an interactive redirect, for example

git rebase -i HEAD~3 

an interactive forwarding editor opens (vim in my case) allowing me to edit commits for 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 rebase and exit vim using :q , rebase will start anyway. I am using git version 1.9.0.msysgit.0 for windows.

Of course, I can just delete all pick lines, but it can be a lot if I reinstall a longer story. Is there another way?

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

+62
git git-rebase
Dec 01 '14 at
source share
4 answers

If you want to exit vim with an error code do

 :cq 

and he will interrupt the permutation. See here and vimdoc here .

+94
Apr 02 '15 at 17:48
source share

you can use

 :%d|x 

to delete all lines, then save and exit

delete all lines of a file in Vim

How to exit the Vim editor?

VIM - several commands in one line

+38
Dec 01 '14 at 11:35
source share

If you use Notepad ++ on Windows, for example:

Ctrl A to select everything, then Del or Backspace to delete and Ctrl S save. Git will abort recovery if the file is empty.

You can also press Ctrl C at the command prompt where Git is running to stop the current rebase command. Then run git rebase --abort to return it.

+5
Sep 09 '15 at 3:34
source share

Delete all text on the text editor screen, then save the default file.

+1
Dec 09 '16 at 5:38
source share



All Articles