If you haven’t defined a core.editor
for Git to use, it defaults to using vi for commit messages, interactive rebases, and other commands that require user input. Before we identify how to setup a core.editor
you might need the following information:
How the *$#@& do I get out of vi?
First, don’t worry, everyone gets stuck in vi. Second, it is really easy to get out of vi using the following:
Saving the Commit
- Press the
esc
key. -
Enter
:wq
to save (orw
rite) your commit message.You can enter
:q
toq
uit the editor without saving your commit message.
Discarding the Commit
- Press the
esc
key. - Enter,
:q!
. This will discard the commit without discarding your changes. If you want to double check that your changes still exist, entergit status
and your changes will still be displayed.
You have successfully gotten out of vi, nicely done.