In all the Git tutorials I\'ve read they say that you can do:
git init
git add .
git commit
When I do that I get a big text file opened up.
Now that I've changed my editor to emacs, everything work fine.
But before I set this, "git commit -a" did open gedit, but also immediately ended with a "Aborting commit due to empty commit message.". Saving the file from gedit had no effect. Explicitly setting the editor with "git config --global core.editor "gedit"" had the same result.
There's nothing wrong with emacs, but out of curiosity why doesn't this work with gedit, and is there any way to get it to work?
Thanks.
The following is probably the easiest way to commit all changes:
git commit -a -m "Type your commit message here..."
Of course there are much more detailed ways of committing, but that should get you started.
Being new to Terminal as well, "Escape and then ZZ" worked for me, I've been having this issue for months and also couldn't find a way around it.
Thanks TheGeoff for your simple advice!
You're meant to put the commit message in this text file, then save and quit.
You can change the default text editor that git uses with this command:
git config --global core.editor "nano"
You have to change nano to whatever command would normally open your text editor.
I was confused because I kept trying to enter a filename after the :w in VIM. That doesn't trigger the commit. Instead I kept getting a message "Aborting commit due to empty commit message." Don't put a filename after the :w. :w saves the file to .git/COMMIT_EDITMSG by default. Then :q to exit to complete the commit. You can see the results with git log.