Aborting commit due to empty commit message

后端 未结 20 1938
[愿得一人]
[愿得一人] 2020-12-04 09:45

As a newbie git user, when I try to commit my work with

git commit -a -v

and I enter a commit message in my editor, I close the file, and g

相关标签:
20条回答
  • 2020-12-04 10:11

    For Visual studio Code

    git config --global core.editor "code -w"
    

    For atom

    git config --global core.editor "atom -w"
    

    For sublime

    git config --global core.editor "subl -w"
    
    0 讨论(0)
  • 2020-12-04 10:11

    I'm also a newbie in Git. I encountered basically the same problem as yours. I solved this by typing:

    git commit -a -m 'some message'
    

    The reason is that git doesn't allow commit without messages. You have to associate some messages with your commit command.

    0 讨论(0)
  • 2020-12-04 10:11

    I got this problem, and found out that if I dont put any comment after committing, it gives me that error. If I jump to get back to the main bash straight away, it doesnt commit.Just to be more clear, Im using GIT Bash, not other editor

    0 讨论(0)
  • 2020-12-04 10:12

    When I used the complete atom filepath it didn't work, so instead of using:

    git config --global core.editor "c:/programs/atom/atom.exe -w"
    

    I used:

    git config --global core.editor "atom -w"
    

    and it worked just fine. Good luck!

    IMPORTANT: First make sure that atom starts correctly calling it directly (atom) from the command line you are using.

    0 讨论(0)
  • 2020-12-04 10:14

    I got this error, and even though i used git config --global core.editor "code -w", it still wouldn't wait for me to close the file. It would just abort instantly.

    My problem was that I had run this command earlier git config core.editor "code".

    It seems that core.editor (which I presume is a local working directory specification), took precedence over --global core.editor.

    If git config --global core.editor "code -w" (or whatever editor you are trying to use) does not work for you, try omitting the --global.

    0 讨论(0)
  • 2020-12-04 10:17

    If you want to commit with a proper (long, multi-line comment) documentation, but don't want the -m option, what you can do (and that I do when preparing my commits) is to:

    • write your documentation (while you are making the changes) in a separate file 'doc-commit' (or whatever name you want to call it)
    • commit with a 'git commit -a -F /path/to/doc-commit')

    In short, use a separate file (which can be at any path you want) as your commit message.

    0 讨论(0)
提交回复
热议问题