Mercurial (Hg) commands summary

Type hg before all the following commands. In some cases, sudo hg is also needed (e.g. if you don’t have user rights to push to a central repo).

revert -all undo changes since last commit
cat -r8 a.txt print old version of a file
diff -r0:1 a.txt changes between two revisions
update -r2 go back to revision 2
clone sourcedir targetdir create a copy of repository
outgoing see which changes are about to be pushed
push submit the changes to the central repo
incoming see which changes are about to be pulled
pull get the latest changes from the central repo
log -P what was pulled
log -l 3 limit log to 3 changes
tag text add a tag. This creates a changeset.

NOTE: last revision is not necessarily equal to the working copy of a file. It is the last commited copy.

NOTE: hginit.com/02.html in the end contains a reasonable work-flow for more than one team member

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s