Search code examples
windowsgitvigit-commit

"Please enter a commit message for your changes"


enter image description here

This window drives me crazy

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#

It pops up when I forget to put -m"[message]" after "git commit", and now when I'm experiment with "git revert" I've seen instructions on how to abort this, but what if I actually want to submit a commit message? How do I do that? Pressing enter doesn't work, so what does?


Solution

  • The first line before

    # Please enter the commit message for your changes. Lines starting
    # with '#' will be ignored, and an empty message aborts the commit.
    #
    

    is precisely there for adding your commit message.

    You press i, and you enter insert mode. You can navigate around the text and insert what ever you want. When done, press Esc. This makes you exit insert mode. Next you have to press :wq, which means to write and quit.

    This will save your commit message.