Mercurial logo

Mercurial is a distributed version control system (DVCS), like Git. It helps you track changes in source code, collaborate with others, roll back mistakes, and manage multiple versions of your project.

Why use Mercurial instead of git?

Here are some reasons someone would prefer Mercurial:
  1. Simplicity and consistency

  2. Mercurial has a cleaner, more consistent command set than Git.

    Example: hg log, hg status, hg commit are straightforward and uniform.

  3. Performance

  4. It was designed for very large repositories (big history, many commits).

    Still fast today, especially for operations like history browsing.

  5. Better history handling

  6. Mercurial’s changesets are immutable, meaning you don’t rewrite history as easily as in Git.

    That’s safer in collaborative environments where history rewriting is risky.

  7. Better for some workflows

  8. Some large projects (Mozilla, Python for many years, Facebook in parts) used Mercurial because it scaled well with big teams and repos.

    Tools like SourceHut integrate with it.

  9. Learning curve

  10. Many people find Mercurial easier to teach to beginners compared to Git’s “plumbing vs porcelain” confusion.

Installation

Information about installation can be found at Mercurial's official webpage, you can reach it here.

Basic workflow

Configure Mercurial, as first step, you should teach Mercurial your name. For that you open the file ~/.hgrc (or mercurial.ini in your home directory for Windows) with a text-editor and add the ui section (user interaction) with your username:

[ui]
username = Mr. Johnson <johnson@smith.com>
Create new repository
hg init myproject
cd myproject
Add some files
echo "Hello Mercurial!" > hello.txt
hg add
Commit changes
hg commit -m "Initial commit
See repository status
hg status # modified/untracked files
hg log # history of commits
hg diff # see changes
Branching
hg branch new-feature
hg commit -m "Start new feature"
Cloning & sharing
hg clone https://hg.sr.ht/~vdozer/website
hg pull         # get new changes
hg push         # send your changes

If there are any issues/mistakes you can mail me at vdozer [at] tuta [dot] com.

Monero donations: 45sETv3BbWqi8BeaCjUtycE1UG4shMFefLKdtkziTBwY8NJUHA4zZjadK8Y7912UsZ92tP1C3FeDD8hTdtNKQxTdMjHuUL1 | Here is the QR.