What to do after typing in commit message for git?

43.1k Views Asked by At

After I type in git commit -a a text editor pops up and I type in my comment. What buttons do I have to press after typing in the comment, to get it to move to the next stage of actually committing?

I'm using mysysGit on Windows with the default setup.

4

There are 4 best solutions below

1
On BEST ANSWER

Depends on the text editor you are using. Git chooses the editor specified in the environment variable "EDITOR." On Linux systems this is usually either Vi or Nano. Figure out which it is and then refer to the documentation for the appropriate editor.

1
On

try this:

git add file-name  
git commit -m "here goes my awesome commit message"  
git push  
2
On

Save the file and exit your editor.

0
On

A git commit always requires a comment. You can give one like this git commit -m "my comment". If you do not provide a comment here, then a text editor pops up to force you to give a comment.

Sometimes, you may actually need the editor to put in the commit message. This generally is required when you want to give a more detailed description of the commit along with the summary (write the summary followed by a blank line followed by the description).

This is an extract from git help commit.

Though not required, it's a good idea to begin the commit message with a single short (less than 50 character) line summarizing the change, followed by a blank line and then a more thorough description. Tools that turn commits into email, for example, use the first line on the Subject: line and the rest of the commit in the body.

EDIT:

And after you type text in your text editor, just save and close it. If you try to do it without providing any comment, the commit will fail.