Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I exit from the text window in Git?

Tags:

git

vim

I am using Windows and before committing, Git wants me to enter a text message and a new text window appears.

screenshot

How can I exit from this?

I am trying to learn Git. So, a little help will be highly appreciated.

like image 941
newbie Avatar asked Feb 07 '12 05:02

newbie


People also ask

How do I escape from git editor?

Type the description at the very top, press esc to exit insert mode, then type :x! (now the cursor is at the bottom) and hit enter to save and exit.

How do I close a window in git bash?

If your shell prompt is $ you are at bash . To exit from bash type exit and press ENTER .

How do I save and exit from git editor?

If you want to save your changes and quit, press Esc then type :wq and hit Enter or ↵ or on Macs, Return .


1 Answers

Since you are learning Git, know that this has little to do with git but with the text editor configured for use. In vim, you can press i to start entering text and save by pressing esc and :wq and enter, this will commit with the message you typed. In your current state, to just come out without committing, you can do :q instead of the :wq as mentioned above.

Alternatively, you can just do git commit -m '<message>' instead of having git open the editor to type the message.

Note that you can also change the editor and use something you are comfortable with ( like notepad) - How can I set up an editor to work with Git on Windows?

like image 92
manojlds Avatar answered Oct 04 '22 18:10

manojlds