hg remove [OPTION]... FILE...

aliases: rm

remove the specified files on the next commit

Schedule the indicated files for removal from the current branch.

This command schedules the files to be removed at the next commit. To undo a remove before that, see "hg revert". To undo added files, see "hg forget".

-A/--after can be used to remove only files that have already been deleted, -f/--force can be used to force deletion, and -Af can be used to remove files from the next revision without deleting them from the working directory.

The following table details the behavior of remove for different file states (columns) and option combinations (rows). The file states are Added [A], Clean [C], Modified [M] and Missing [!] (as reported by "hg status"). The actions are Warn, Remove (from branch) and Delete (from disk):

opt/state A C M !
none W RD W R
-f R RD RD R
-A W W W R
-Af R R R R

Note that remove never deletes files in Added [A] state from the working directory, not even if option --force is specified.

Returns 0 on success, 1 if any warnings encountered.


-A --after record delete for missing files
-f --force remove (and delete) file even if added or modified
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns

[+] marked option can be specified multiple times

global options:

-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
--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
--color TYPE when to colorize (boolean, always, auto, or never) (default: auto)

[+] marked option can be specified multiple times