Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't exit Git commit in Windows

Tags:

git

vi

windows

From Powershell I've called git commit and it presents me with

enter image description here

I typed the commit message (in yellow) but I have no idea what to do next. Pressing Enter just adds a newline to my input. How do I complete the commit? I've been through several tutorials but none of them explained the next step.

EDIT: So I found I can press : to make the cursor jump to the bottom line, then type wq to complete the commit. What exactly is this? Is it correct? Are there any alternatives?

like image 872
Bobbler Avatar asked May 29 '16 02:05

Bobbler


People also ask

How do I leave a git commit window?

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.

How do you get out of commit?

git exit commit message After writing commit message, just press Esc Button and then write :wq or :wq! and then Enter to close the unix file.

How do I come out of git?

If you want to save your changes and quit, press Esc then type :wq and hit Enter or ↵ or on Macs, Return . Git (2.28+) allows configuration of the name of the branch created when you initialize any new repository.


1 Answers

After typing the message, press Escape to exit insert mode and then type :wq (write/save and quit, or :q! if you want to cancel and return to the prompt). Alternatively, you can commit in one step by typing git commit -m "message"

like image 150
Martin Ciz Avatar answered Sep 19 '22 01:09

Martin Ciz