Mercurial Tutorials

Mercurial is a powerful and popular distributed version control system, which provides you with a way to
both archive and save older versions of your code, along with the changes made to each revision, plus it makes it easy to work
on your source code simultaneously with other people.

Knowing and using some form of version control is all but a necessity for anyone working with any source code, no matter now
big or small the project is.

This set of tutorials will show you how to use Mercurial, along with BitBucket, a popular repository website that pairs well
with Mercurial.

Note: This set of tutorials is new and in development. Consider yourself a beta reader of these tutorials. If you notice any
errors (technical, grammatical, etc.) or anything that is just plain confusing, please bring it to my attention.


1 - What is Version Control?

This tutorial explains the purpose of version control and why you should use it. The two reasons are
to provide you with a revision history, and to collaborate with others. It explains that either reason, taken alone, should
be plenty of motivation to use version control, even if you don't think the other reason applies. It defines the basic
concepts (files, repositories, checking out, committing, updating) at the conceptual level. This will also talk about the
variety of version control systems (SVN, Git, Mercurial, and many more) and explain that we'll use Mercurial here, but
other choices are fine too.
What is Version Control?


2 - Downloading Mercurial and TortoiseHg

This is a short tutorial that outlines where to go to download Mercurial and TortoiseHg. It will
introduce the Hg Workbench and the Windows shell commands (in the sense of pointing out that they're there, not in how to
use them).
Downloading Mercurial and TortoiseHg


3 - The Basics of Version Control

This tutorial will be the first that starts to actually do stuff with Mercurial. This will go through
the logical progression of creating a repository, creating files, adding files, editing files, committing changes, and
also reverting. It will describe the basic process of make changes, if you like them, commit, of you don't, revert, and
The Basics of Version Control


4 - Diff

Embedded in Mercurial is a program called a diff tool. (Specifically, KDiff3.) The diff tool is at the heart of
how Mercurial can know what files have changed and which haven't, as well as the details about what specifically changed. In
this tutorial, we'll take a quick look at how to access this tool, so that you can dig in to the changes you've made yourself.


5 - Ignoring files

Some files don't belong in the repository, because either they are binary (which doesn't work so well in any
version control system) and can be recompiled from other files, or because they are user-specific, and you don't want to share them with
everyone else (who will have different settings). This tutorial will explain what files should be ignored, and how to do it.
Ignoring files


6 - Concepts of Distributed Version Control

This tutorial covers how disributed version control, which uses more than one repository, works at a conceptual level.
Distributed version control is one of the key benefits of a modern version control system like Mercurial.
Concepts of Distributed Version Control


7 - Working with Multiple Repositories

In the previous tutorial we cover the fundamentals of distributed version control, which uses multiple repositories, at
a conceptual level. In this tutorial, we'll put that knowledge to practice, by cloning multiple repositories, and pushing and pulling changesets.
This is all good preparation for the next tutorial, where we'll look into using BitBucket as a remote location to store repositories.
Working with Multiple Repositories


8 - BitBucket

In this final tutorial, we'll cover how to create a repository on, which makes it easy to share your code
with other people on your team. (It also functions as an off-site backup, so if your computer fails or your house burns down, you won't lose your
code!) This tutorials covers how to create an account on BitBucket, how to create a project, and how to push and pull changes from your repository