Mercurial > hg-stable
Help: prune
hg prune [OPTION]... [-r] REV...
aliases: obsolete
mark changesets as obsolete or succeeded by another changeset
Pruning changesets marks them obsolete, hiding them from the history log, provided they have no descendants. Otherwise, all such descendants that aren't themselves obsolete become "unstable". Use 'hg evolve' to handle this situation.
When you prune the parent of your working copy, Mercurial updates the working copy to a non-obsolete parent.
You can use "-s/--successor" to tell Mercurial that a newer version (successor) of the pruned changeset exists. Mercurial records successor revisions in obsolescence markers.
If you prune a single revision and specify multiple revisions in "-s/--successor", you are recording a "split" and must acknowledge it by passing "--split". Similarly, when you prune multiple changesets with a single successor, you must pass the "--fold" option.
If you want to supersede multiple revisions at the same time, use the "--pair" option to pair the pruned precursor and successor changesets. This is commonly useful for resolving history divergence, or when someone else edits history without obsolescence enabled.
"hg prune A::B -s C::D --pair" will mark all revisions in the A::B range as superseded by the revisions in C::D. Both revsets need to have the same number of changesets.
options ([+] can be repeated):
-n | --new VALUE [+] | successor changeset (DEPRECATED) |
-s | --successor REV [+] | successor changeset |
-r | --rev REV [+] | revisions to prune |
-k | --keep | does not modify working copy during prune |
-n | --note TEXT | store a note on prune |
--pair | record a pairing, such as a rebase or divergence resolution (pairing multiple precursors to multiple successors) | |
--biject | alias to --pair (DEPRECATED) | |
--fold | record a fold (multiple precursors, one successor) | |
--split | record a split (one precursor, multiple successors) | |
-B | --bookmark BOOKMARK [+] | remove revs only reachable from given bookmark |
-d | --date DATE | record the specified date in metadata |
-u | --user USER | record the specified user in metadata |
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: UTF-8) | |
--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) |