To exit your vim editor with a non-zero exit code, execute :cq
.
This is specially useful when you need to bail out of an interactive git rebase.
Exiting your vim session with a non-zero exit status (while in interactive
rebase mode) triggers an error similar to Could not execute editor
which
effectively leaves your tree unchanged.