Enjoy this cheat sheet at its fullest within Dash, the macOS documentation browser.

Create a Local Repository

hg init .

Create a mercurial repository of current directory with a .hg/ folder

hg add filename1 filename2

Begin tracking filename1 and filename2 in mercurial

hg commit -m 'Initial commit'

Save files and commit message to repository

Clone Remote Repository

hg clone remote-repo [local-directory]

Clone a remote mercurial repository to a local directory

Update from Remote Repository

hg incoming [remote-repo]

List changesets available

hg pull

Pull all new changesets into local

hg pull -r remote-repo

Pull specified changesets into local


Option: also update working directory


hg merge

Merge changesets to local repository

hg merge branchname_or_revision

Merge from a named branch or revision into the current local branch

hg resolve --mark filename

Inform mercurial about the resolution of merge conflicts

hg commit

After successful merge, commit the changes

Undos and Fixes

hg rollback

Undo commit, import, pull, local push or unbundle

Only use in private repositories.

hg update --clean

Cancel an uncomm­itted merge and lose changes

hg revert

Undo all uncomm­itted changes

Create an Archive

hg archive

Create an archive

Example args: -rREV filena­ or -rREV filena­me.t­ar.gz

Work Files and Tracking

hg add file

Begin tracking changes

hg addrem­ove

Track new, forget missing

hg forget file

Stop tracking file

hg remove file

Stop tracking & delete

hg copy file target

Copy file

hg move file target

Move file

These changes must also be committed to avoid data loss.

Work Directory Updates

hg update tip

Update work to match tip

hg update -rREV

Update work to specified revision

Work Status

hg diff

List tracked file changes

hg diff file

List changes to a file

hg status

List status of files

Added, Clean, De­leted, Ig­nored, Mo­dified or Un­known

Local Repository History

hg serve

Fire up a builtin local webserver for browsing and sharing repository over HTTP

hg log file/dir

History of changesets

hg annotate file

Who changed what, when

hg paths

List known remote repositories

hg heads

List heads

hg parents

Before merge, you can look up the parents of the branch

hg diff -rREV -rREV

Show differ­ences between REVs

Remote Update and Publish

hg push [remote-repo]

Push changesets to remote

hg share

Sync history with parent and siblings



Collection of revisions


A file which stores defaults for a repository. Global is ~/.hgrc and local is .hgrc inside the repository


Committed changeset, by REV number


Set of work changes saved as diffs


Changes between files


Name for a specific revision


Immediate ancestor(s) of revision or work


Child of a revision


A head is a changeset with no child changesets


The process of merging two HEADS


Latest revision in any branch


All diffs between two revisions


Patch with permis­sions and rename support

Help and Usage


Basic command list

hg help

Full command list

hg help command

Detailed help reference

hg command

-opti­on... argume­nt...

Common Options


Specify a REV number (default parent)


Do not prompt, pick each first option


Quiet (supress output)


Verbose (addit­ional detail)


Force (override reasonable warnings)