hg purge [OPTION]... [DIR]...

aliases: clean

removes files not tracked by Mercurial

Delete files not known to Mercurial. This is useful to test local and uncommitted changes in an otherwise-clean source tree.

This means that purge will delete the following by default:

But it will leave untouched:

The --files and --dirs options can be used to direct purge to delete only files, only directories, or both. If neither option is given, both will be deleted.

If directories are given on the command line, only files in these directories are considered.

Be careful with purge, as you could irreversibly delete some files you forgot to add to the repository. If you only want to print the list of files that this program would delete, use the --print option.

options ([+] can be repeated):

-a --abort-on-err abort if an error occurs
--all purge ignored files too
-i --ignored purge only ignored files
--dirs purge empty directories
--files purge files
-p --print print filenames instead of deleting them
-0 --print0 end filenames with NUL, for use with xargs (implies -p/--print)
--confirm ask before permanently deleting files
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns

global options ([+] can be repeated):

-R --repository REPO repository root directory or name of overlay bundle file
--cwd DIR change working directory
-y --noninteractive do not prompt, automatically pick the first choice for all prompts
-q --quiet suppress output
-v --verbose enable additional output
--color TYPE when to colorize (boolean, always, auto, never, or debug)
--config CONFIG [+] set/override config option (use 'section.name=value')
--debug enable debugging output
--debugger start debugger
--encoding ENCODE set the charset encoding (default: ascii)
--encodingmode MODE set the charset encoding mode (default: strict)
--traceback always print a traceback on exception
--time time how long the command takes
--profile print command execution profile
--version output version information and exit
-h --help display help and exit
--hidden consider hidden changesets
--pager TYPE when to paginate (boolean, always, auto, or never) (default: auto)

mercurial