From ArchWiki
Revision as of 09:05, 15 May 2010 by Jasonwryan (Talk | contribs) (Use: Creating a dotfile repo)

Jump to: navigation, search

Tango-document-new.pngThis article is a stub.Tango-document-new.png

Notes: please use the first argument of the template to provide more detailed indications. (Discuss in Talk:Mercurial#)

Mercurial (commonly referred to as hg) is a distributed version control system written in Python and is similar in many ways to Git, Bazaar and darcs.


Mercurial is available from the standard repositories:

# pacman -S mercurial


At the minimum you should configure your username or mercurial will most likely give you an error when trying to commit. Do this by editing ~/.hginitrc and adding the following:

username = John Smith


All mercurial commands are initiated with the hg prefix. To see a list of some of the common commands, run

$ hg help

You can either work with a pre-existing repository (collection of code or files), or create your own to share.

To work with a pre-existing repository, you must clone it to a directory of your choice:

$ mkdir mercurial
$ cd mercurial
$ hg clone

To create you own, change to the directory you wish to share and initiate a mercurial project

$ cd myfiles
$ hg init myfiles

Dotfiles Repo

If you intend on creating a repo of all your Template:Filename files, you simply initiate the project in your home folder:

$ hg init

It is then just a case of adding the specific files you wish to track:

$ hg add file1 file2 file3

You can then create a Template:Filename to ensure that only the files you wish to include in the repository are tracked by mercurial.

Tip: If you include: syntax: glob at the top of the .hgignore file, you can easily exclude groups of files from your repository.

More Resources