Mercurial Distributed version control
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
hg statushg add <file>
hg commit -m "<msg>"
hg pull -uhg pushhg log -Ghg diffhg update <rev>
Concepts
- Working dir your files
- Local repo changesets
- Remote default path
Setup
hg inithg clone <url> [<dir>]
hg config --edit
hg config ui.username
hg pathshg roothg versionhg help <command>
hg help -e <ext>
Snapshot
hg statushg add [<file>]
hg commit -m "<msg>"
hg commit -m "<msg>" <file>
hg commit -ihg commit --amend
hg diffhg diff -c <rev>
hg diff -r <a> -r <b>
hg addremovehg remove <file>
hg forget <file>
hg rename <old> <new>
hg copy <src> <dst>
hg revert <file>
hg revert --allhg purgeHistory
hg loghg log -Ghg log -l <n>
hg log <file>
hg log -r "<revset>"
hg log -k <text>
hg annotate <file>
hg cat -r <rev> <file>
hg summaryhg identifyhg headshg grep <pattern>
hg bisect --badhg bisect --good <rev>
Remotes
hg pullhg pull -uhg pushhg push -r <rev>
hg incominghg outgoinghg push --new-branch
hg servehg bundle <file> <base>
hg unbundle <file>
Update and branches
hg update <rev>
hg update -C <rev>
hg branchhg branch <name>
hg brancheshg bookmark <name>
hg bookmarkshg update <bookmark>
hg bookmark -d <name>
hg push -B <bookmark>
hg tag <name>
hg tagsMerge and undo
hg mergehg merge <rev>
hg resolve --list
hg resolve --mark <file>
hg resolve --all --tool <tool>
hg commithg graft <rev>
hg backout <rev>
hg shelvehg unshelvehg shelve --list
hg rollbackhg aborthg continuehg recoverRewrite history
hg rebase -d <dest>
hg rebase -s <src> -d <dest>
hg histedit <rev>
hg fold --from <rev>
hg phasehg phase -f --draft <rev>
hg evolvehg log -r "draft()"
Config and extensions
| Revset | Meaning |
|---|---|
tip |
newest changeset |
. |
working dir parent |
draft() |
not yet public |
a::b |
a to b with ancestors |
branch(<name>) |
on a branch |
user(<name>) |
by an author |
| Extension | Adds |
|---|---|
rebase |
hg rebase |
histedit |
hg histedit |
shelve |
hg shelve |
purge |
hg purge |
evolve |
safe history rewriting |
[ui]username = Your Name <you@example.com>[extensions]rebase =histedit =purge =
hg --config <section.key>=<val>
<cmd>
hg --debug <cmd>
hg verifyhg manifesthg export <rev>
hg import <patch>
hg archive <file>
Recipes
hg pull -u# edit fileshg statushg commit -m "Fix parser"hg push
hg bookmark feature-x# work and commithg push -B feature-x
hg pullhg headshg mergehg resolve --listhg commit -m "Merge"
hg log -r "draft()"hg histedit <first-draft>hg rebase -d default



