I'm looking for the Mercurial equivalent of git commit --allow-empty
for testing purposes.
Asked
Active
Viewed 400 times
0

Alex Henrie
- 744
- 1
- 6
- 17
-
possible duplicate of [How can I force mercurial to accept an empty commit](http://stackoverflow.com/questions/3561608/how-can-i-force-mercurial-to-accept-an-empty-commit) – Pablo Santa Cruz Feb 13 '14 at 20:15
-
That thread deals with importing empty commits from SVN, which is not my problem. – Alex Henrie Feb 13 '14 at 20:30
3 Answers
2
Can't be done. There doesn't have to be a change to a source file, but you have to have changes something, be it file permissions, branch name, tag, or something.
You say "for testing purposes". If that's the case I usually just use
echo another line >> README ; hg commit -m 'added another line'
I can hit up-arrow enter on that plenty fast.

Ry4an Brase
- 78,112
- 7
- 148
- 169
1
I think the best solution I've found is:
touch foo
hg add foo
hg commit -m 'Empty commit'
hg rm foo
hg commit --amend

Alex Henrie
- 744
- 1
- 6
- 17
-
This works beautifully --- thanks! (Although the fact that I have to do this in order to get an empty commit is kinda silly.) – David Given Jun 25 '18 at 20:48
0
Works with MQ. Make a MQ changeset with some dummy change, then revert the change and refresh (hg qref
) the patch. Voila.

Ringding
- 2,856
- 17
- 10