0% found this document useful (0 votes)
47 views2 pages

Mercurial HG

This document is a Mercurial (Hg) cheat sheet that provides an overview of common Hg commands and concepts. It defines key Hg terminology like repository, revision, changeset, diff, tag, branch, merge, head, tip, and bundle. It also summarizes commands for creating and working with local and remote repositories, cloning from remote repositories, updating and committing changes, viewing histories and diffs, merging, and more. The cheat sheet is intended to serve as a quick reference guide for common Hg workflows and commands.

Uploaded by

rizi110
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views2 pages

Mercurial HG

This document is a Mercurial (Hg) cheat sheet that provides an overview of common Hg commands and concepts. It defines key Hg terminology like repository, revision, changeset, diff, tag, branch, merge, head, tip, and bundle. It also summarizes commands for creating and working with local and remote repositories, cloning from remote repositories, updating and committing changes, viewing histories and diffs, merging, and more. The cheat sheet is intended to serve as a quick reference guide for common Hg workflows and commands.

Uploaded by

rizi110
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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 unrela​ted​_pr​oject
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 simpli​city! 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:/​/me​rcu​ria​l.s​ele​nic.com
hg update --clean can cancel an uncomm​‐
A complete Local repository of changesets http:/​/hg​ini​t.com
itted merge while losing changes.
that is saved in Work/.hg/ (don't edit!)
http:/​/hg​boo​k.r​ed-​bea​n.com
Hg - Create an Archive
Hg - Local Repo History
Hg - Remote Repository
hg archive -rREV filena​me.zip
hg log file/dir History of changesets
hg archive -rREV filena​me.t​ar.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 differ​ences 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 - Termin​ology
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 uncomm​itted 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 permis​sions 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... argume​nt...


required non-li​teral 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 (addit​ional 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

You might also like