How to abort a git rebase from inside vim during interactive editing

Just delete all the lines that are not comments from the file. Then save it to the default supplied path and exit the editor.

As a result git will just do nothing in this rebase.

To delete all lines in vim you can use

:%d|x

Then save and quit.

delete all lines of file in Vim

How to exit the Vim editor?

VIM - multiple commands on same line


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.


If you exit the editor with an error code, the rebase will be aborted.

To exit with an error code on vim, do

:cq

See here and vimdoc here.