Cheatography
https://cheatography.com
Cheat Sheet for the Mercurial distributed source version control management tool. System.http://mercurial.selenic.com/
Hg - Work Directory
A local Work folder containing one Revision and any uncommited changes you've made. |
Hg - Undos and Fixes
hg rollback can undo commit, import, pull, local push, and unbundle. Only use in private repos. |
hg update --clean can cancel an uncommitted merge while losing changes. |
Hg - Create an Archive
hg archive -rREV filename.zip |
hg archive -rREV filename.tar.gz |
Hg - Work Files and Tracking
hg add file |
Begin tracking changes |
hg addremove |
Track new, forget missing |
hg forget file |
Stop tracking file |
hg remove file |
Stop tracking & del |
hg copy file target |
Copy file |
hg move file target |
Move file |
These changes to Work must also be Committed to avoid data loss.
Hg - Work Directory Updates
hg update tip |
Update Work to match Tip |
hg update -rREV |
Update Work to specified Revision |
hg revert |
Undo all uncommitted changes |
Hg - Work Status
hg diff |
Lists tracked file changes |
hg diff file |
List changes to a file |
hg status |
Lists status of files |
Added, Clean, Deleted,
Ignored, Modified, Unknown
|
|
Hg - Local Repository
A complete Local repository of changesets that is saved in Work/.hg/ (don't edit!) |
Hg - Local Repo History
hg log file/dir |
History of changesets |
hg annotate file |
Who changed what, when |
hg paths |
Lists known remote Repos |
hg heads |
List heads |
hg diff -rREV -rREV
Shows differences between REVs
Hg - Create a Local Repo
hg init Work |
Creates ./.hg/ subfolder & Repo |
hg add |
Begin tracking all files |
hg commit -m 'Initial commit' |
Save files and Commit message to Repo |
Hg - Update from Remote Repo
hg incoming Remote |
List changesets available |
hg pull |
Pull all new changesets into Local |
hg pull -r Remote |
Pull specified changesets into Local |
-u |
Also Update Working Directory |
Hg - Union Merge
hg pull --force unrelated_project |
hg merge |
hg commit |
Powerful simplicity! Use wisely.
|
|
Hg - Remote Repository
A Remote repository reached via url path, often a main team repo from which Local is cloned. |
Hg - Remote Update and Publish
hg push Remote |
Push changesets to Remote |
hg share |
Sync history with parent and siblings |
Hg - Terminology
Repository |
Repo. Collection of Revisions. |
Revision |
Rev. Commited changeset, by REV number. |
Changeset |
Set of Work changes saved as Diffs. |
Diff |
Changes between files. |
Tag |
Name for a specific Rev. |
Parent |
Immediate ancestor of Rev or Work. |
Branch |
Child of Rev. |
Merge |
Rev with two parents. |
Head |
Latest Rev in Branch. |
Tip |
Latest Rev in ANY Branch. |
Patch |
All Diffs between two Revs. |
Bundle |
Patch with permissions and rename support. |
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.) |
|
Created By
https://github.com/codeshane
Metadata
Favourited By
Comments
DaveChild, 09:18 15 Aug 12
Wow! Great cheat sheet! :)
codeshane, 09:48 15 Aug 12
Thanks. Plenty of room for improvement, but getting started is the hardest part. :D
Isxek 12:10 21 Aug 12
Does "hg share" require an extension? Running "hg help share" gets me the "unknown command" error.
Shane 09:49 10 Sep 12
Sorry for the late reply, wasn't expecting a Q&A here .. the "share" extension is included with Hg, but disabled by default. The link below explainshow to set it up, hope it helps! http://mercurial.selenic.com/wiki/ShareExtension
NafSadh Khan 12:38 22 Jul 15
Can't start download. http://www.cheatography.com/codeshane/cheat-sheets/mercurial-hg/pdf/ is referring back to http://www.cheatography.com/codeshane/cheat-sheets/mercurial-hg/ :(
Add a Comment
Related Cheat Sheets