Scroll to navigation

HG(BACKOUT) HG(BACKOUT)

NAME

hg backout - reverse effect of earlier changeset

SYNOPSIS

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

DESCRIPTION

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).

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

merge with old dirstate parent after backout
commit if no conflicts were encountered (DEPRECATED)
do not commit
parent to choose when backing out merge (DEPRECATED)
revision to backout
invoke editor on commit messages
specify merge tool
include names matching the given patterns
exclude names matching the given patterns
use text as commit message
read commit message from file
record the specified date as commit date
record the specified user as committer

[+] marked option can be specified multiple times