Mercurial Cheat Sheet

See also MercurialEclipse



You can use yum, but it typically will provide a relatively old version

yum install hg

To get a more recent version:


sudo apt-get install mercurial

Mac OS X

Minimum setup

Configure a proper email address in ~/.hgrc (Windows C:\Program Files\Mercurial\Mercurial.ini) by adding lines such as the following:

username = John Doe <>

Basic Commands

Create new project

cd /path/to/project
hg init
hg status

hg add
hg commit
hg status

Files are added to the project

Enable server

cd /path/to/project
hg serve --name project --port 8000

Project can be accessed through


Send repository or changes to remote server

$ hg push http://remotehost:8000

Once finished, on the remove server:

$ hg update

To allow insecure remote access (from Mercurial FAQ):

4.5. I get an "ssl required" error message when trying to push changes

If you're on a network you trust you can add

allow_push = *
push_ssl = false

in your <repository-name>/.hg/hgrc file.

Restore repository from backup

Some issues that may arise:

Additional commands

Mercurial (last edited 2013-09-27 10:03:39 by JaumeSola)