35

I have done a 'hg merge' however when I attempt to do a 'hg commit -m "my msg.." I get the following error message :

abort: cannot commit merge with missing files

Can anyone explain how to fix this to allow the commit go through?

Zabs
  • 13,852
  • 45
  • 173
  • 297

3 Answers3

56

Try hg status and look for files in state ! (missing).

The cause is that one of the files which is part of the merge has been deleted. Undelete the file and try again.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
14

Heres my approach

hg status will tell you what files are missing. Then you can either restore the file from somewhere

OR type in hg remove <path/name of missing file>

THEN commit. Your repo will be sane again, darwin willing.

Shayne
  • 1,571
  • 1
  • 16
  • 20
  • 1
    This is the answer the worked for me. Had to manually `hg remove` the file. Another "would have just worked in Git" gotchya.... – smeeb Jun 07 '16 at 10:57
  • For me, I couldn't even remove the file with that command because it could not be found. So I just created an empty file of the same missing file name, and it worked for me after that. – Baraka Mahili Dec 29 '22 at 23:32
  • I honestly wouldnt know how HG works in 2022. After Atlassian killed mercurial in Bitbucket, it was the end of the road for me and mercurial. Which is a shame, because I maintain to this day that mercurial is the superior version control system. – Shayne Jan 05 '23 at 10:50
2

If you are using TortoiseHG, click in View/Commit. It will show you files in state ! (missing).

Right click on the file and choose Revert (undelete the file) and commit.

Iasmini Gomes
  • 727
  • 1
  • 9
  • 14