Abort Interactive Rebase when VSCode is set as the Git Editor

26.6k Views Asked by At

I've set VSCode to be my git editor as detailed here.

When I try to do: git rebase HEAD~3 -i it opens a new Code window, and as soon as the interactive rebase VSCode window closes the window that contained the terminal that fired off the command starts to do the rebasing.

As far as I can understand from this the editor needs to fire off an error code to abort the rebase.

I wasn't sure if there's a way to do this in VSCode or if I need to open up an issue/enhancement on their git repository? Or are you supposed to just clear out all the lines and then close it which should be the same? Does this abort it?

3

There are 3 best solutions below

1
On

VSCode 1.74 (Jan 2023)

There is a way to abort rebase easily with the internal actions of VSCode source control:

enter image description here

0
On

Simply clearing the contents and saving the rebase that opens up in VS Code during the interactive rebase will abort the rebase as noted in its comments:

# However, if you remove everything, the rebase will be aborted.

Steps

  1. Clear all contents, or comment them out with the help of multi-line editing.
  2. Save the document.
  3. Close the VS Code window that opened for the interactive rebase.
  4. You should return back to your original VS Code window with the rebase command stating: Nothing to do
3
On

I wasn't sure if there's a way to do this in VSCode (2017)

Three years, there should be a way to abort/cancel a rebase with VSCode 1.46 (May 2020)

Abort in progress rebase

You can now abort an in progress rebase operation using the Git: Abort Rebase command.

See issue 99015 (from issue 72576) and PR 97071.


You can use it through the command palette:

Ctrl+Shift+P: Git: Abort Rebase