I am just learning git and the terminal and I wanted to make a test commit but I cannot seem to be able to escape the text editor window to save the commitenter image description here

2 Answers 2


It looks like you're inside the vi editor. Typing :wq and pressing enter should do it, i.e. save the commit message and exit.

: enters the command mode, w is for "write" (save) and q is for "quit".

You may need to hit escape before :wq to exit the insert mode (vi is a mode based editor).

If you want to exit without saving hit escape, :q! and enter.

git opens your default editor so you can edit the commit message. You can change the default editor, even to graphical text editors (such as Sublime Text). See here for example.

  1. Press Escape
  2. Press shift+Z shift+Z (capital Z twice).

It works a bit faster.

  • OMG that's horrible vs code did not give any clue how to get out of it. thanks for saving my life.
    – sairfan
    Commented Apr 3, 2023 at 19:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .