TL;DR – How to Exit Vim If you didn't make any changes, type :q and press Enter / return. If you made some changes and would like to keep them, type :wq and press Enter / return.
Press ESC to make sure you are out of the edit mode and then type:
:wq
Instead of telling you how you could execute a certain command (Esc:wq), I can provide you two links that may help you with VIM:
However, the best way to learn Vim is not only using it for Git commits, but as a regular editor for your everyday work.
If you're not going to switch to Vim, it's nonsense to keep its commands in mind. In that case, go and set up your favourite editor to use with Git.
Esc to make sure you exit insert mode, then :wq
(colon w q) or ZZ
(shift-Z shift-Z).
Press i
or a
to get into insert mode, and type the message of choice
Press ESC
several times to get out of insert mode, or any other mode you might have run into by accident
to save, :wq
, :x
or ZZ
to exit without saving, :q!
or ZQ
To reload a file and undo all changes you have made...:
Press several times ESC
and then enter :e!
.
A faster way to
would be
:x
If you have opened multiple files you may need to do a
:xa
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With