hg-update
Update working directory to a specific revision
TLDR
Update to the tip of the current branch
Update to the specified revision
Update and discard uncommitted changes
Update to the last commit matching a specified date
SYNOPSIS
hg-update [OPTION]... [REVISION]
PARAMETERS
-r
Update to the specified revision, which can be a changeset ID, tag, branch name, or bookmark.
-C, --clean
Discard all uncommitted changes in the working directory before updating.
Use with extreme caution as changes are lost permanently.
-f, --force
Force the update operation. This implicitly handles uncommitted changes by either merging them or, if no merge is possible, requiring a clean.
-m, --merge
Merge pending changes into the target revision. This is the default behavior when uncommitted changes exist.
-d
Update to the revision closest to the specified date and time.
--mq
Apply or unapply Mercurial Queue patches as part of the update process.
--tool
Specify a merge tool to use for resolving conflicts during the update.
DESCRIPTION
The hg-update command, often a shell alias or script wrapper for the core Mercurial hg update command, is used to synchronize the working directory with a specified revision in the repository's history. This allows users to switch between branches, revert to older states, or fast-forward to newer changesets. If no revision is specified, hg-update defaults to updating to the tip of the current branch. When uncommitted changes exist in the working directory, hg-update by default attempts to merge these changes with the target revision. Alternatively, users can explicitly discard local changes using the --clean option or force an update (implying a merge or clean operation) with --force. It's a fundamental command for navigating and managing different states within a Mercurial repository.
CAVEATS
Using --clean will permanently discard any uncommitted changes in your working directory. Always commit or shelve changes before using this option unless you are certain you want to lose them.
Updates that involve significant changes or conflicts might require manual merging.
The hg-update command is commonly a shell alias or wrapper script for the primary hg update command provided by Mercurial. Its exact behavior might depend on how it's configured in your environment.
REVISION SPECIFICATION
The REVISION argument can be specified using various methods:
• Changeset ID: A full or abbreviated hexadecimal ID (e.g., `a1b2c3d4e5f6`).
• Branch Name: (e.g., `default`, `feature-branch`).
• Tag Name: (e.g., `release-1.0`).
• Bookmark Name: (e.g., `my-dev-bookmark`).
• Special Keywords: Such as `tip` (the latest head of any branch), `.` or `null` (the working directory's current parent), `parent()` or `@` (the current revision).
DEFAULT BEHAVIOR
If no REVISION is specified, hg-update updates the working directory to the tip of the current branch. If uncommitted changes exist, it attempts to merge them with the target revision. If an update would lose uncommitted changes and --clean is not used, the command will abort unless --force is specified.
HISTORY
Mercurial, and by extension its core update command, was initially released in April 2005. The update functionality has been a fundamental part of Mercurial's design from its early stages, providing a robust way to navigate and manage the repository's history and working directory state. Its primary mechanisms, such as handling uncommitted changes through merging or cleaning, have remained consistent throughout Mercurial's development.