hg clean is pure evil

Masklinn masklinn at masklinn.net
Fri Nov 5 06:26:19 CDT 2010


On 2010-11-05, at 12:14 , Aardwolf wrote:
> hg clean is a very dangerous command imho.
It's not.

> I've lost files multiple times due
> to it. The problem is that it sounds a lot like the "cleanup" command of
> SVN, and I've typed "hg clean" a few times already with a different
> intention (in the hope it'd fix things)
So you use commands randomly with no understanding of what it does?

> but instead it removed unversioned
> files, such as my project file and complete local pieces of code…
Why don't you either ignore or version your project files? hg clean will only touch (and remove) files appearing as unknown in `hg status` (barring a bug in clean). The general rule is to ignore any file you need but do not want to version (e.g. the files generated by virtualenv when you work on a Python package), and in that case `hg clean` is perfectly safe.

Same for whatever "complete local pieces of code" are supposed to be, `hg clean` only removes files marked as unknown by hg status.


More information about the Mercurial mailing list