How do I delete all untracked files from my working directory in Mercurial?

前端 未结 10 496
长情又很酷
长情又很酷 2021-01-29 18:11

Is it possible to delete all untracked files from my working directory? Let\'s say I added a bunch of files to my working directory, didn\'t add them via \'hg add\' and now want

10条回答
  •  [愿得一人]
    2021-01-29 18:44

    Add the Mercurial Extension called purge. It is distributed by Mercurial.

    This extension adds a “purge” command to “hg” that removes files not known to Mercurial. i.e. untracked Files. So your command would be,

    hg purge
    

    It is not enabled by default, maybe to avoid accidentally removing files that you forgot to add.

    To install this extension, add this to your mercurial settings file (.hgrc on Unix, Mercurial.ini on Windows)

    [extensions]
    purge = 
    

    To enable this extension temporarily you can use

    hg purge --config extensions.purge= 
    

提交回复
热议问题