17

Is there a way to configure Mercurial to allow for empty commit messages? If you try hg commit through the CLI without entering a commit message, the commit is canceled with: abort: empty commit message.

Now, I know that committing without a message is usually considered bad form, but does Mercurial allow it at all?

derekerdmann
  • 17,696
  • 11
  • 76
  • 110
  • 5
    it's bad form for a reason, and I'm curious about a valid use case for it, if you don't mind sharing. – Gregg Lind Aug 02 '10 at 20:45
  • 1
    I was working on a project where I was the only person using the repo, and the IDE liked to make changes when it closed. I didn't want to leave uncommitted changes sitting in the repository, so I had intended to use empty messages for those instances; not really that big of a deal. Now it's more out of curiosity than anything else. – derekerdmann Aug 02 '10 at 20:53
  • 2
    I usually use "Derp." when I'm too lazy to come up with valid commit message. – Cat Plus Plus Nov 25 '11 at 01:19
  • 1
    @derekerdmann It's all nice and good to be organized with your commit messages, but some projects really are small enough that they are unnecessary. But forget about that, my question is: What's the point of forcing a message? The user will just enter a dummy message anyway, and you will have gained nothing. – Superbest Feb 21 '12 at 02:42
  • You _can_ have an empty comment if your repository was imported from another VCS --- I just found one and it caused no end of problems. This is not necessarily useful, however. – David Given Dec 22 '13 at 13:45

2 Answers2

6

You can use just a space, but I'd really discourage it:

hg commit -m " "
PatrickSteele
  • 14,489
  • 2
  • 51
  • 54
4

If the problem is that you don't want to enter the -m "blah" part you can always set up an alias. e.g. in hgrc

[alias]
qcommit = commit -m "quick commit - no message"

If you don't like qcommit then you can alias to commit instead i.e.

[alias]
commit = commit -m "quick commit - no message"

this won't help you with TortoiseHG however which presumebly validates its entry fields before passing data to mercurial iteslf

jk.
  • 13,817
  • 5
  • 37
  • 50
  • 2
    `qcommit` is probably a bad idea as far as the name of an alias goes. Commands starting with `q` are normally mercurial queue (MQ) commands – Paul S Nov 02 '11 at 15:33
  • agree the whole feature is probably a bad idea anyway though – jk. Nov 02 '11 at 17:48