Skip to content Skip to main navigation Skip to footer

Mercurial Cheatsheet


Configure global information

# This command launches default editor
# Set "username" in [UI] section:
#     username = Mercury Gitlab <>
$ hg config --edit


Create a new local repository

hg init

$ mkdir hello-world
$ cd hello-world
# Init repository
$ hg init
# Simple example: add a file and commit changes
$ echo "Hello World" >
$ hg add
$ hg commit -m "Initial commit"

Cloning an Existing Repository

hg clone remote-repo [local-directory]

$ hg clone my-hello

real URL is
requesting all changes
adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 2 files
new changesets 0a04b987be5a:82e55d328c8c
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved

Day-to-day activities

Show the working tree status

hg status

$ hg status
M hello.c

Added, Clean, De­leted, Ig­nored, Mo­dified or ?Un­known