git and hg - the next holy war?
3 min read

git and hg - the next holy war?

When it comes to version control systems the darling child right now is git, and for good reasons: it's fast, it's easy to use (at least compared to the older version control systems out there) and allows for a real fast development process with lots of branching and relatively painless merging.

One of the downsides of git though is the fact that, until recently, it was relative hard to get running on Windows; and this is where Mercurial (hg from now on) came in: being written in Python it was easier to install on non-nix systems as well as providing most of the same benefits as git does when comparing to older DVCS' out there.

The problem with Hg though is that it didn't have the word of mouth git did (I mean, the Linux kernel uses git as its distributed version control system), was a bit slower.

An even larger issue is that git owes a lot of its popularity to GitHub, which made collaborating on open source projects both easier and, more importantly cool. See, there is a Hg version of GitHub, BitBucket, but it has one major downside: it's so much slower compared to GitHub. Part of this is due to Mercurial itself, but part of it is due to the way BitBucket itself is built; granted, the devs of BitBucket made a lot of changes to improve the speed of the website, and now it's mostly on par with GitHub, but it's a bit too late.

git now has a lot of mindshare. Pointy Haired Boss types have heard of it, so when an enterprise vendor comes along mentioning Git, it tickles their fancy, because PHBs often know that Git is "better than svn"--which it is--which is an automatic plus. If you present hg to a PHB, you're going to get a blank stare. If Mercurial will ever see market penetration, it will be in orgs that haven't calcified to the point where PHBs are a thing.

And it seems that git is extending. Eric Raymond posted this to the emacs-devel (Emacs uses bzr for source control) list, which includes:

git won the mindshare war. I regret this - I would have preferred Mercurial, but it too is not looking real healthy these days. I have made my peace with git's victory and switched. I urge the Emacs project to do likewise.

This mindshare also translates into better Googleability, 3rd party tools, books and so on, which further distances git from Hg.

One major and often neglected thing Mercurial does have over git though is the fact that is much easier to extend due to it being written in Python as opposed to C, and this might be exactly what might save Hg or, who knows, even push it in front of git.

Facebook recently switched to Mercurial for its code repositories precisely because of this ease of improving Hg in-house, which is the largest win Hg got in a while, and hopefully this trend will go on.

Granted, git could be improved as well, but writing C is usually requires more attention than Python and, especially when it comes to web services, tends to be harder to deploy and keep working.


What needs to be remembered though is that git and Mercurial aren't the only contenders in town, and that there is a lot of legacy and entrenched DCVS' out there.

Based on data from Ohloh, a website which indexes a large number of open source projects, the split between code versioning systems is as follows:

Created with Highstock 1.3.0Bazaar: 2%CVS: 9%Git: 38%Mercurial: 2%Subversion: 46%Subversion: 292,340 (46%)

Google Trends also shows how the popularity of each system changed over time:

This might look bad for Mercurial, but we need to remember that git started from a similar percentage, so all is not lost.

In the end though, git vs Mercurial is the DVCS version of vi vs emacs, Linux vs BSD, etc. They both have essentially the same functionality and a typical team would do fine with either.