DragonautX DragonautX - 1 month ago 6
Git Question

How do I get out of a blue-text cmd screen after running 'git commit' without a message?

I did a

git add
for a
codeshare10-18.txt
I wanted to push into my own respository. I then did
git commit codeshare10-18.txt
, and since I forgot to add a message, I got a warning with this at the end:

"C:/Users/Nicolas/Desktop/workshop/neobis001.github.io/.git/.COMMIT_EDITMSG.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:


I didn't know what to do, so I pressed
E
because I thought I could add a message that way. I got this colored screen in return:

enter image description here

I tried typing a message like "Added a txt". The "A" got cut off, and when I tried to press Enter, it just made a newline in cmd to type more stuff. What is this window, and how do I get out of this window without clicking the X button? I tried Ctrl + C, Esc, and "exit" plus Enter, but none of them worked. I know next time I should include a message, but I'd still like to know how to get out of here via a console command.

Answer

That is the vim text editor.

When it opens up, you can to the following:

  • Press i to enter insert mode
  • Type in your commit message
  • press ESC to exit insert mode
  • press ZZ to save and exit

Alternatively, for the last step you can type in :wqENTER (ZZ is just a shortcut to that).

Comments