Delete All Untracked Files in Mercurial

July 4, 2010

Is there a way to delete all untracked files in a mercurial working area? Yes, with the purge extension.

Installing Purge

This extension is shipped by default with mercurial but turned off. To enable it, modify your config file (.hgrc on Unix, Mercurial.ini on Windows) to add

[extensions] 
purge =

This activates the plugin. You can now use

$ hg purge

to delete all untracked files.

References

Tags: mercurial hg purge