Go to page content

Just Enough Mercurial

Get started with one of the major distributed version control systems.


Version control is an essential tool for software development and maintenance. Until recently, Mercurial was the official version control system for Zotonic. It has been switch to Git beginning september 2011.


Mercurial will run on both UNIX and Windows system. Installation below assumes that you are loading a Mercurial binary from an apt repository. See references for information on installation from source or yum.

All commands were tested on Ubuntu 11.04.


How can I install mercurial?

apt-get update apt-get install mercurial 

How can I configure mercurial?

Create a file called .hgrc in your home directory, then enter and save:

[ui] username = yourname editor = your_favorite_editor 

See also:

hg help config 

How can I get a list of commands?

For essential commands


For a full list of commands

hg help 

How can I clone a project's source code?

hg clone https://someproject.googlecode.com/hg/ someproject 

How can I initialize Mercurial in a directory?

hg init 

How can I add all the source files?

hg add 

How can I add a file name?

hg add <filename> 
hg commit -m “Comment for adding the filename”

How can see what files have been added or changed, but not committed?

hg status 

How can I commit a change?

hg commit -m “Description of the change” 

How can I undo a change?

hg revert <filename-to-revert> 

How can I remove a file?

hg remove <filename> 
hg commit -m “Comment for removing the file”

How can I rename a file?

hg rename <filename> <new-filename> 
hg commit -m “Comment for above changes”

How can I review additions and changes in this directory?

hg log 


There are no troubleshooting steps available for this guide. Please provide any you have learned in the comments below or on the Zotonic Users Group.



Hg – Tips and Tricks

Hg Init: a Mercurial tutorial

Version control with Mercurial

Managing your web site with Mercurial

Submitted: 7/7/11

This page is part of the Zotonic documentation, which is licensed under the Apache License 2.0.