hg-pull
Copy changes from another Mercurial repository
TLDR
Pull from the "default" source path
Pull from a specified source repository
Update the local repository to the head of the remote
Pull changes even when the remote repository is unrelated
Specify a specific revision changeset to pull up to
Specify a specific branch to pull
Specify a specific bookmark to pull
SYNOPSIS
hg pull [OPTION]... [SOURCE]
hg pull [OPTION]... --force --uncompressed
PARAMETERS
-u, --update
Update the working directory to the tip of the new branch after pulling. This is equivalent to running hg update after the pull.
-r, --rev <REV>
Pull only a specific revision or branch. Can be specified multiple times to pull a set of revisions.
-b, --branch <BRANCH>
Pull only a specific named branch. Can be specified multiple times to pull a set of branches.
-f, --force
Force the pull operation, even if incoming changes conflict or the remote repository's history is unrelated to the local one. Use with caution.
--no-update
Prevent updating the working directory, overriding any configured automatic update behavior (e.g., from hg fetch aliases).
--uncompressed
Bypass zlib compression during data transfer, useful for debugging or specific network conditions where compression is detrimental.
--insecure
Allow connections to repositories that offer only insecure (non-TLS, non-SSH) access, often for debugging or testing purposes.
--ssh <CMD>
Specify the SSH command to use for secure remote connections, overriding the default or configured SSH client.
--remotecmd <CMD>
Specify the command to run on the remote side for communication, usually for advanced server configurations.
--repository <PATH>
Specify the remote repository path. This is an alias for the SOURCE argument.
--bookmarks
Explicitly pull bookmarks along with changesets. This is often the default behavior but can be useful for clarity.
--tool <TOOL>
Use a specific merge tool if conflicts arise during an update that is performed automatically by hg pull -u.
--dry-run
Perform a simulated pull operation and report what would be pulled without actually modifying the repository.
--all
Pull all heads from the remote repository. This is typically the default behavior for a standard pull but can be explicitly stated.
--revs
Pull revisions listed in a specified file. The file must contain one revision identifier per line.
DESCRIPTION
hg pull is a fundamental command in Mercurial, a distributed version control system. It's used to fetch new changesets from a remote repository into your local repository. Unlike hg clone, which creates a new repository, hg pull updates an existing one. When you pull, Mercurial downloads the latest changes from the specified source (which can be a path to a local repository or a URL for a remote one) and incorporates them into your local history.
It's important to note that hg pull only downloads changesets; it does not automatically update your working directory. This means your files on disk remain unchanged after a pull, unless you explicitly use the --update (or -u) option, or follow up with an hg update command. This separation allows you to inspect the incoming changes before applying them to your working copy, providing flexibility for managing merges or reviewing history. It's a key operation for keeping your local repository synchronized with upstream changes in a collaborative environment.
CAVEATS
hg pull only fetches changesets into your local repository; it does not automatically update your working directory. To see the fetched changes in your files, you must explicitly run hg update or use the --update option during the pull. If conflicts arise during an update after pull (e.g., with -u), manual merge resolution will be required. Pulling from an unrelated or significantly diverged repository might require the --force option, which should be used with extreme caution as it can lead to complex repository states.
DEFAULT PULL PATH
If no SOURCE is specified, hg pull will attempt to pull from the path specified by the 'default' configuration key in your local repository's .hg/hgrc file. This is typically the repository from which your local repository was cloned.
REMOTE REPOSITORY SPECIFICATION (SOURCE)
The SOURCE argument can be a local path to another repository (e.g., /path/to/repo), a URL (e.g., http://example.com/repo, ssh://user@host/repo), or a named path configured in the [paths] section of your .hg/hgrc file (e.g., hg pull my_remote).
HISTORY
Mercurial was created by Matt Mackall in 2005, primarily in response to the licensing changes for BitKeeper, which had previously been used for Linux kernel development. The pull command, being a core operation in distributed version control systems, has been a fundamental part of Mercurial since its early days. Its design reflects the DVCS philosophy of local repositories being self-contained, with pull serving as the mechanism to synchronize with other repositories without necessarily affecting the local working copy immediately, providing greater control over the integration process.