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 get this error:
Aborting commit due to empty commit message.
I have read nearly all the topics addressing to this issue, changed editors, basically tried everything but nothing helps. What should I do?
One thing I noticed, while trying the whole process with notepad++, the file couldn't be saved.
A possible workaround is this:
git commit -am "SomeComment"
But by doing so I feel I am kind of nullifying the purpose of using git. I want to properly document my changes.
The "Git: Commit Empty" command requires the user to enter a commit message, otherwise it will abort the commit.
Git makes this process of pushing an empty commit super simple. It's like pushing a regular commit, except that you add the --allow-empty flag. You can see that the commit has been pushed to your branch without any changes after running the above commands.
Pushing an empty commit without adding any staged files to the branch is very easy. It is the same as pushing a regular commit, except that all you need to do is add –allow-empty flag to the command line. The commit is now pushed to your branch without any changes.
Like --allow-empty this command is primarily for use by foreign SCM interface scripts. It allows you to create a commit with an empty commit message without using plumbing commands like git-commit-tree[1].
When you set an editor in the configuration of Git, make sure to pass the parameter "-w" to force Git to wait your commit message that you would type on your custom editor.
git config --global core.editor "[your editor] -w"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With