Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aborting commit due to empty commit message

Tags:

git

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.

like image 299
cngkaygusuz Avatar asked Mar 15 '12 17:03

cngkaygusuz


People also ask

What will happen if an empty commit message is entered?

The "Git: Commit Empty" command requires the user to enter a commit message, otherwise it will abort the commit.

Can you push an empty 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.

How do I force an empty commit?

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.

What is commit empty in git?

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].


1 Answers

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" 
like image 180
Zakaria AMARIFI Avatar answered Sep 19 '22 13:09

Zakaria AMARIFI