Problems with entering Git commit message with Vim

OS: Windows

I write

$ git commit


"# Please enter the commit message"

I write some text, like

"Form validation added"

Press Enter and not commited. Then i press Shift+Enter, Ctrl+Enter, Alt+Enter - still not commited.

I think its stupid trouble, but What i must to do?


If it is VIM for Windows, you can do the following:

  • enter your message following the presented guidelines
  • press Esc to make sure you are out of the insert mode
  • then type :wqEnter or ZZ.

Note that in VIM there are often several ways to do one thing. Here there is a slight difference though. :wqEnter always writes the current file before closing it, while ZZ, :xEnter, :xiEnter, :xitEnter, :exiEnter and :exitEnter only write it if the document is modified. All these synonyms just have different numbers of keypresses.

I am assuming you are using msys git. If you are, the editor that is popping up to write your commit message is vim. Vim is not friendly at first. You may prefer to switch to a different editor. If you want to use a different editor, look at this answer: How do I use Notepad++ (or other) with msysgit?

If you want to use vim, type i to type in your message. When happy hit ESC. Then type :wq, and git will then be happy.

Or just type git commit -m "your message here" to skip the editor altogether.

Have you tried just going: git commit -m "Message here"

So in your case:

git commit -m "Form validation added"

After you've added your files of course.

Typically, git commit brings up an interactive editor (on Linux, and possibly Cygwin, determined by the contents of your $EDITOR environment variable) for you to edit your commit message in. When you save and exit, the commit completes.

You should make sure that the changes you are trying to commit have been added to the Git index; this determines what is committed. See for details on this.

You can change the comment character to something besides # like this:

git config --global core.commentchar "@"

Need Your Help

How to create a database from shell command?

mysql shell command-line

I'm looking for something like createdb in PostgreSQL or any other solution that would allow me to create database with a help of a shell command. Any hints?

Problem in running .net framework 4.0 website on iis 7.0 iis-7 .net-4.0 cgi isapi

Hey I got problem in running .NET framework 4.0 website on IIS7.0.