• 0

How to abort a git commit amend

Sometimes you issue a git commit --amend only to realize that you didnt really mean to amend the previous commit. You'd rather save your changes as a new commit. This can happen under many circumstances like changing your mind at the last moment or accidentally issuing the command from the command line history.

There are 2 ways to abort a commit amend without saving changes

  1. If vi editor is the one that opens up to amend your commit message, you can simply press ESC + : + c + q + !
  2. If you are using any other editor, you dont have the option to use that shortcut, but you could always erase the commit message. That makes git think that you are trying to commit with a blank commit message and it therefore aborts without saving.