hg update [-c] [-C] [-d DATE] [[-r] REV]

aliases: up, checkout, co

update working directory (or switch revisions)

    Update the repository's working directory to the specified changeset. If
    no changeset is specified, update to the tip of the current named branch
    and move the current bookmark (see "hg help bookmarks").

    Update sets the working directory's parent revision to the specified
    changeset (see "hg help parents").

    If the changeset is not a descendant or ancestor of the working
    directory's parent, the update is aborted. With the -c/--check option, the
    working directory is checked for uncommitted changes; if none are found,
    the working directory is updated to the specified changeset.

    The following rules apply when the working directory contains uncommitted
    changes:

    1. If neither -c/--check nor -C/--clean is specified, and if the requested
       changeset is an ancestor or descendant of the working directory's
       parent, the uncommitted changes are merged into the requested changeset
       and the merged result is left uncommitted. If the requested changeset
       is not an ancestor or descendant (that is, it is on another branch),
       the update is aborted and the uncommitted changes are preserved.
    2. With the -c/--check option, the update is aborted and the uncommitted
       changes are preserved.
    3. With the -C/--clean option, uncommitted changes are discarded and the
       working directory is updated to the requested changeset.

    To cancel an uncommitted merge (and lose your changes), use "hg update
    --clean .".

    Use null as the changeset to remove the working directory (like "hg clone
    -U").

    If you want to revert just one file to an older revision, use "hg revert
    [-r REV] NAME".

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

    Returns 0 on success, 1 if there are unresolved files.

options:

 -C --clean     discard uncommitted changes (no backup)
 -c --check     update across branches if no uncommitted changes
 -d --date DATE tipmost revision matching date
 -r --rev REV   revision

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

[+] marked option can be specified multiple times