When you are amending a commit or doing an interactive rebase of a series of commits, Vim will open and when you close the file, git will continue with the procedure. But if you want to cancel the commit or rebase?
Vim allows you to quit with an error code.
:cq
This means that irrespective of the content of the buffer, Vim will signal to Git with an error code to not process the commit or rebase, effectively aborting the action.