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 [-r REV]... [-b BRANCH]... [--rebase] [--update] [--force] [--insecure] [SOURCE]
PARAMETERS
-r REV
Pull only changesets that are descendants of REV.
-b BRANCH
Pull only changesets on BRANCH.
--rebase
Rebase uncommitted changes on top of pulled changes.
--update
Update the working directory to the tip of the pulled changes after pulling.
--force
Allow pulling from an unrelated repository.
Warning: This can lead to data corruption.
--insecure
Allow connecting to an HTTP server without verifying its identity.
SOURCE
The source repository to pull from (URL or local path). If omitted, uses the default path.
DESCRIPTION
The hg pull command in Mercurial retrieves changesets from a specified source repository and integrates them into the local repository. It fetches the latest versions of branches and tags, allowing the local repository to stay synchronized with upstream changes. By default, hg pull does not automatically merge these changes into the working directory. The user must then explicitly use commands like hg merge and hg commit to resolve conflicts and finalize the integration. Pulling is an essential operation for collaborative development workflows where multiple developers contribute to the same project, ensuring that each contributor has access to the most up-to-date code base. The command updates the local repository's metadata, allowing subsequent merge operations to proceed correctly. If no source is specified, the default pull location is determined by the repository configuration file.
CAVEATS
Using --force can result in a corrupted repository if the repositories are truly unrelated. Always back up your repository before using this option. Pulling does not automatically merge changes; a separate merge operation is required.
AUTHORIZATION
When pulling from a remote repository, the hg pull command may require authentication. Mercurial supports various authentication methods, including HTTP basic authentication, SSH keys, and password prompts. The authentication method used depends on the protocol and configuration of the remote repository.
BRANCHES AND HEADS
After pulling, new branches from the source repository will be visible locally. However, the working directory will not automatically switch to any of these new branches unless the --update flag is used or if the pulled changes are merged into the current branch. Use hg branches to list the available branches after pulling.
HISTORY
Mercurial (hg) was initially developed by Matt Mackall and released in 2005. The hg pull command has been a core feature since the initial release, providing the means to synchronize repositories in a decentralized version control system. Over time, the command has been enhanced with additional options to control which changesets are pulled and how the working directory is updated. The primary purpose remains consistent: to fetch changes from another repository and integrate them into the local repository.