Mercurial (Hg) Cheat Sheet
by CodeShane (codeshane) via cheatography.com/1611/cs/523/
Hg - Work Directory                                 Hg - Work Status                                   Hg - Union Merge
A local Work folder containing one Revision         hg diff            Lists tracked file changes      hg pull --force unrelated_project
and any uncommited changes you've made.             hg diff file       List changes to a file          hg merge
                                                    hg status          Lists status of files           hg commit
Hg - Undos and Fixes
                                                    Added, Clean, Deleted,                             Powerful simplicity! Use wisely.
hg rollback can undo commit, import, pull,
                                                    Ignored, Modified, Unknown
local push, and unbundle. Only use in
                                                                                                       Hg - Resources
private repos.
                                                    Hg - Local Repository
                                                                                                       http://mercurial.selenic.com
hg update --clean can cancel an uncomm‐
                                                    A complete Local repository of changesets          http://hginit.com
itted merge while losing changes.
                                                    that is saved in Work/.hg/ (don't edit!)
                                                                                                       http://hgbook.red-bean.com
Hg - Create an Archive
                                                    Hg - Local Repo History
                                                                                                       Hg - Remote Repository
hg archive -rREV filename.zip
                                                    hg log file/dir        History of changesets
hg archive -rREV filename.tar.gz                                                                     A Remote repository reached via url path,
                                                    hg annotate            Who changed what,           often a main team repo from which Local is
                                                    file                   when                        cloned.
Hg - Work Files and Tracking
                                                    hg paths               Lists known remote
hg add file            Begin tracking
                                                                           Repos                       Hg - Remote Update and Publish
                       changes
                                                    hg heads               List heads                  hg push            Push changesets to Remote
hg addremove           Track new, forget
                                                    hg diff -rREV -rREV                                Remote
                       missing
                                                    Shows differences between REVs                    hg share           Sync history with parent and
hg forget file         Stop tracking file
                                                                                                                          siblings
hg remove file         Stop tracking & del
                                                    Hg - Create a Local Repo
hg copy file           Copy file                                                                       Hg - Terminology
                                                    hg init Work            Creates ./.hg/ subfolder
target
                                                                            & Repo                     Repository       Repo. Collection of Revisions.
hg move file           Move file
                                                    hg add                  Begin tracking all files   Revision         Rev. Commited changeset,
target
                                                    hg commit -m            Save files and Commit                       by REV number.
These changes to Work must also be
                                                    'Initial commit'        message to Repo            Changeset        Set of Work changes saved
Committed to avoid data loss.
                                                                                                                        as Diffs.
                                                    Hg - Clone Remote Repo                             Diff             Changes between files.
Hg - Work Directory Updates
                                                    hg clone Remote Work                               Tag              Name for a specific Rev.
hg update tip      Update Work to match Tip
                                                                                                       Parent           Immediate ancestor of Rev or
hg update -        Update Work to specified         Hg - Update from Remote Repo
                                                                                                                        Work.
rREV               Revision
                                                    hg incoming           List changesets available    Branch           Child of Rev.
hg revert          Undo all uncommitted            Remote
                                                                                                       Merge            Rev with two parents.
                   changes
                                                    hg pull               Pull all new changesets
                                                                                                       Head             Latest Rev in Branch.
                                                                          into Local
                                                                                                       Tip              Latest Rev in ANY Branch.
                                                    hg pull -r            Pull specified changesets
                                                                                                       Patch            All Diffs between two Revs.
                                                    Remote                into Local
                                                                                                       Bundle           Patch with permissions and
                                                    -u                    Also Update Working
                                                                                                                        rename support.
                                                                          Directory
                 By CodeShane (codeshane)           Published 15th August, 2012.                       Sponsored by Readable.com
                                                    Last updated 12th May, 2016.                       Measure your website readability!
                                                    Page 1 of 2.                                       https://readable.com
cheatography.com/codeshane/
github.com/codeshane
                                          Mercurial (Hg) Cheat Sheet
                                          by CodeShane (codeshane) via cheatography.com/1611/cs/523/
Hg - Help
hg                                Basic command list.
hg help                           Full command list.
hg help command                   Detailed help reference.
Hg - Command Line
hg command -option... argument...
required non-literal reference
Hg - Common Options
-rREV       Specify a Rev number (default parent.)
-y          Don't prompt; pick each first option.
-q          Quiet (supress output.)
-v          Verbose (additional detail)
-f          Force (override reasonable warnings.)
              By CodeShane (codeshane)                 Published 15th August, 2012.   Sponsored by Readable.com
                                                       Last updated 12th May, 2016.   Measure your website readability!
                                                       Page 2 of 2.                   https://readable.com
cheatography.com/codeshane/
github.com/codeshane