Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Both Git and Mercurial are DVCS, and that's great. I wonder if there is a list of particular situations when one of those systems are preferable, something like 'In mobile development for many platforms git is better because ...'.

share|improve this question

closed as primarily opinion-based by MichaelT, durron597, Snowman, Ixrec, GlenH7 Sep 18 '15 at 21:15

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

Check out – Demian Brecht May 19 '11 at 15:40
I have read that they are very similar, and a frequent comparison is: "Mercurial is like James Bond, git is like MacGyver" – whatsisname May 19 '11 at 20:31
+1 Good question: both are among the popular tools so its instructive to compare their merits – therobyouknow Jun 2 '11 at 10:37
Reason #1: Github. Reason #2: Did you look at reason #1? – tylerl Jul 19 '12 at 3:09
It is always possible to defer your choice. Just try both, it is trivial to migrate your repository from one to another and back again. – SK-logic Jul 19 '12 at 5:18
up vote 41 down vote accepted

Operating System

Are you and/or your team Windows based?: Mercurial is less hassle to use/set up than Git, since it kind of needs you to install a bash console (you can use cygwin instead though).

If you are linux/mac based, either choice is fine, but you might like git more because of all its power tools.

Experience with DVCSs

If you are new to DVCSs, choose Mercurial. If not, try git. Git has lots of toys that might make your learning curve somewhat steeper, Mercurial, OTOH, you will learn in a breeze. Read for a very comprehensive guide.

Also, read if you come from CVS/SVN.


Mercurial is a full-featured DVCS, git OTOH I'd even say its almost a DVCS framework (check this cheatsheet out) that can support more specific workflow cases for very big teams/projects.

Also, very importantly, git lets you change your repository history, which can be considered a bad thing (); Mercurial does not let you change your history.

In general terms, I'd say git is overkill in a good way. Personally, I use both mercurial and git, but I always teach mercurial to my coworkers

There is no wrong choice

Actually and IMHO, you should learn both, but always start with Mercurial. Too really see how they compare (which are really somewhat smaller details) I recommend you reading these two articles:

The path of the DVCS

Try mercurial first to make your introduction to DVCSs way more pleasant. I've seen a lot of people rant their way into git and end up loving it, but OTOH I've seen people make their whole way into mercurial in complete awe. After that, if you feel mercurial is not enough you can continue your path with git seamlessly.

Update: Mercurial is now better at letting you modify the history, see:

share|improve this answer
Git 1.5 was a DVCS framework. Now it has a much more evolved interface. – alternative May 19 '11 at 21:25
+1 Great answer: titles call out the points. Down to earth honest practicality – therobyouknow Jun 2 '11 at 10:37
+1, even if it's just for the cheatsheet. Nonetheless, your answer is quite amazing! – SteeveDroz Jul 7 '11 at 13:50

You should use git when a project or community you want to contribute to uses git, and use Mercurial when they use Mercurial. It may seem obvious, but the community is more important than the tool.

I would suggest learning both, since they are so similar in many ways, that way you can contribute equally easily to projects and communities that use either.

For example, if you are starting a project to develop a Linux device driver, git is the obvious choice, whereas if it's a python project, hg would be logical.

An excellent description of why Python chose mercurial can be found on the Brett Cannons blog, which links to his paper PEP 374 -- Choosing a distributed VCS for the Python project which documents their decision making process.

Alas, I couldn't quickly find an equivalent paper for a community which chose git instead.

share|improve this answer
And if you are starting the project? Good advice otherwise. – Anto Jun 1 '11 at 18:43
+1 @Mark Booth "You should use git when a project or community you want to contribute to uses git, and use Mercurial when they use Mercurial. It may seem obvious, but the community is more important than the tool." Yes - good - point you have to fit in with what's already there. Otherwise agree with @Anto (+1) – therobyouknow Jun 2 '11 at 10:38
Seems good. You got an upvote (+1) :) – Anto Jun 2 '11 at 10:55

Generally Mercurial is easier to learn than Git

So use Mercurial (Hg) if you want to learn distributed version control and get your pet project off the ground real quick.

Online services such as BitBucket offer the same features as GitHub for collaborative projects.

share|improve this answer
Bitbucket is really cool, thank you. – Vladimir Ivanov May 19 '11 at 11:36
I wouldn't say if you want to get your projects off the ground quick, I would say if you want a simplified DVCS solution. – Josh K May 19 '11 at 14:13

We used SVN, than migrated to MERCURIAL and recently to GIT. Git has some immediate advantages over hg: stashing and the index (simpler atomic commits). Than you'll appreciate the easy branching. You will regret git and miss hg when something goes wrong or when you need to deeply understand some concept like "rebasing" or "fast forwarding". I really hate to have to dig into the options madness of git when I need to do something trivial like "svn revert"... In conclusion: git does too much for the majority of projects that are using it and the learning curve is too steep. (ah, and I really laugh when "git stat" says "Did you mean status?" - I know, alias, I know...)

share|improve this answer
You can stash with the attic extension and commit individual changes (cherrypick) with record. – olt May 20 '11 at 17:56
Both rebasing and fast-forwarding become obvious concepts once you start to look at git as at a system that manages a sequence of patches, as opposed to a system that records points in history. Reordering history is weird; reordering patches without breaking things is not. – 9000 Sep 18 '15 at 13:34

For some time, Mercurial worked better on Windows than Git did, and that was a reason to use Mercurial. It's also generally easier to get into.

Both Mercurial and Git will do pretty much what you want with a DVCS. There are differences, but they're unlikely to matter in day-to-day operations for most people. Learn one first to get the concepts down, then you can learn how to use the other quickly whenever you need or want to.

share|improve this answer

I think it all depends what platform you use. I decided on using git on PHP project that I knew everyone was using *nix because they had no problems typing in commands in.

For my other PHP project we have a lot of people using windows as well as mac and linux. It was a breeze to use Mercurial all of those platforms.

  • Windows - TortoiseHG - brilliant!
  • Linux - Not sure - those guys love command
  • Mac - MacHG - I use myself on my Mac and its very good.

Also I think what is also good is the fact that both NetBeans and Eclipse offer support for Mercurial pretty much out of the box. Last time I tried using git on Eclipse it was very bad and i ended up using console. (It was few months ago)

I think it is better to learn one and then read one of the tutorials that shows you command differences etc. Learning two at the same time will just frustrate you because of some small command differences.

share|improve this answer

This is an old question and the answers were valid at the time they were written.

  • Git seems to no longer be considered “hard work” for use on windows. Microsoft is now using Github, so clearly Git has got traction in the windows community. Visual Studio now has built in Git support. Therefore working on Windows is no longer a reason to choose Mercurial.
  • On StackOverflow there are about 10 times as many Git questions (60K) then Mercurial questions (6.8K) – so clearly both are getting used a lot, but Git seems to be used more.
  • Today on (the leading UK site for IT jobs), there are 41 jobs that ask for Mercurial skills and 592 jobs asking for Git skills, so a lot more companies seem to be using Git.
  • Looking on Amazon there seems to be more books about Git and Mercurial.
  • However I believe that Mercurial is still considered easier to learn then Git.
  • Both Git and Mercurial are clearly able to get the job done for most projects. They are also not that different from each other

Therefore first look at the skills of your team and if they know Mercurial but not Git, it may be a good reason to use Mercurial.

Otherwise I think it is very much like the Videotape wars of my childhood. Betamax was clearly the “best” quality recording, yet VHS won and was clearly the best option for most people, due to it being used by so many more people.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.