Help: backout

hg backout [OPTION]... [-r] REV

reverse effect of earlier changeset

Prepare a new changeset with the effect of REV undone in the current working directory. If no conflicts were encountered, it will be committed immediately.

If REV is the parent of the working directory, then this new changeset is committed automatically (unless --no-commit is specified).

Note:

'hg backout' cannot be used to fix either an unwanted or incorrect merge.

Examples:

  • Reverse the effect of the parent of the working directory. This backout will be committed immediately:
    hg backout -r .
    
  • Reverse the effect of previous bad revision 23:
    hg backout -r 23
    
  • Reverse the effect of previous bad revision 23 and leave changes uncommitted:
    hg backout -r 23 --no-commit
    hg commit -m "Backout revision 23"
    

By default, the pending changeset will have one parent, maintaining a linear history. With --merge, the pending changeset will instead have two parents: the old parent of the working directory and a new child of REV that simply undoes REV.

Before version 1.7, the behavior without --merge was equivalent to specifying --merge followed by 'hg update --clean .' to cancel the merge and leave the child of REV as a head to be merged separately.

See 'hg help dates' for a list of formats valid for -d/--date.

See 'hg help revert' for a way to restore files to the state of another revision.

Returns 0 on success, 1 if nothing to backout or there are unresolved files.

options ([+] can be repeated):

--merge merge with old dirstate parent after backout
--commit commit if no conflicts were encountered (DEPRECATED)
--no-commit do not commit
--parent REV parent to choose when backing out merge (DEPRECATED)
-r --rev REV revision to backout
-e --edit invoke editor on commit messages
-t --tool TOOL specify merge tool
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns
-m --message TEXT use text as commit message
-l --logfile FILE read commit message from file
-d --date DATE record the specified date as commit date
-u --user USER record the specified user as committer
--mq operate on patch repository

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: EUC-JP)
--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)