Coding⏱️ 2 min read📅 2026-05-31

How to Fix: How to do Mercurial's 'hg remove' for all missing files?

Remove all missing files from Mercurial repository

Quick Answer: Use the command 'hg remove -r HEAD !' to remove all locally deleted files.

To remove files that have been deleted locally in Mercurial, you can use the hg remove command with the -r option followed by the commit hash of the last commit where the file was added to the repo.

⚠️ Common Causes

  • Files may have been deleted locally due to a network issue or interrupted commit.

🔧 Proven Troubleshooting Steps

Method 1: Using the Last Commit Hash

  1. Step 1: Run hg log -r HEAD --template '{item}' to get a list of files that have been added in the last commit.

Method 2: Using hg remove with -r option

  1. Step 1: Run hg log -r HEAD --template '{item}' to get the commit hash of the last commit where the file was added.

💡 Conclusion

To remove all missing files, you can use a script like this: hg remove -r [last commit hash] !

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions