mercurial cheatsheet
Authors
Adrian Sai-wah Tam
License
CC-BY-SA
Plaintext
Repository on server: hg serve -p port mkdir project sshd Repository on server:
http://server/project hg init project
ssh://server/project
Create repository
hg clone repository [project] hg clone repository [project]
Repository:
/path/project
hg clone project myProj
hg log [-r REV[:toREV]] [-p]
Copied Repository: hg incoming [repository] Show changesets (-p = with diff)
/path/myProj List changsets from source
hg tip = hg log -r tip
hg pull [-u] [repository] Show the latest changeset
Check-in new changesets from source
or other repository (-u = update as well)
hg branch branch
Name current changeset hg update [-C] [Rev|Tag] update over
as a new branch hg rollback
Revert to before last Update working dir with pulled changeset branch: failed
hg merge branch commit/import/push/pull (-C = discard uncommitted changes)
Merge-in changesets from
another branch
hg merge
Updated repository: Merge change across branch
and notify merge conflicts
/path/project
hg resolve [-a] [files]
Try to remerge unresolved files
(-a = try all unresolved)
Modification hg heads [-r Rev]
Show all branch heads or
hg parents [file] heads of specified revision
Show parent revision of current working dir
If file is given, show revision of last change hg copy oldFile newFile
Make copy of file for modification and mark
hg revert [-r REV] [files] future changes at old as needed in new file
Revert changes in file/dir to an earlier state
default to the parent revision hg rename oldFile newFile
Copy and remove
hg remove files
hg add [files]
hg addremove
Modified copy Automatic add and remove
New Revision
Cheatsheet
hg status Copyright © 2009 Adrian Sai-wah Tam
hg backout --merge REV Check what changed in working dir Licensed under Creative Commons
Create new changeset to reverse
the effect of a particular changeset hg diff [-r RevA [-r RevB]] [files]
Show diff of files between changesets
(default current against tip)
hg commit [-A] [-u 'name <email>'
Create a changeset in local repository
hg unbundle file
hg export Rev > diff Apply the changegroup file changegroup
diff file New Revision in bzip2
hg import diff
hg bundle [--base RevA] [-r RevB] [-a] file
Create a changegroup file from RevA to RevB (-a = all since null)
hg tag [-r Rev] Tag
Give a name to a revision
(default = parent revision)
Repository
hg tag --remove Tag hg outgoing [repository] on server
Remove a name assignment List changesets to destination
hg tags hg push [-r Rev] [repository]
List all names and their revision Push changsets to destination