Why do you use Git over Mercurial? (Or vice versa.)
I currently use Git, and am generally happy with it, but I’d like to know more about Mercurial. Does it have any advantages over Git? What are the advantages of Git over Mercurial?
I realize there are already detailed comparisons of the two, but that’s not what I’m asking for. I don’t want dispassionate information, but rather impassioned (but polite!!!) reasons why you think one is better/easier/faster/smarter/stronger/etc.
11 Solutions collect form web for “Why do you use Git over Mercurial? (Or vice versa.)”
(A) Top 3 real reasons I use Git rather than Mercurial by choice:
- historical stochasticity / inertia
- historical stochasticity / inertia
- historical stochasticity / inertia
(B) Given the above, the top 3 things I like about Git over Mercurial:
- the index
- lightweight branches
- sane tagging (a tag is not a commit that follows the commit that is being tagged)
(C) The three things Mercurial has for it over Git:
- better native documentation (emphasis on native, because the ProGit book is simply outstanding, and anyone who has any complaints about Git or the Git model being too complex or confusing should go directly there)
- sequential commit numbering (local repository scope only, but I imagine this might sometimes be more convenient than cutting-and-pasting SHA-1’s when fiddling about?)
- nicer logo/name?
I think that all (most?) of the items in (B) are either a result of me being used to the Git model due to (A) or can be “fixed” in Mercurial through plug-ins. But the fact remains that Git works the way I want it to out of the box, and I can live without any of the (C) items [given that C(1) is rendered a non-issue due to the excellent ProGit book]. And, so, I continue to use Git over Mercurial.
I have used both Mercurial and git and I vastly prefer hg to git; it just feels nicer. Steve Losh in his blog post The Real Difference Between Mercurial and Git sums up most of my feelings about it. Here are some quotes which I agree wholeheartedly with:
I think there’s still one very, very important difference left: the systems feel very different to use.
I personally find Mercurial’s philosophy easier to work with. It’s easy for me to wrap my head around commands when they’re more modular and less monolithic.
I personally don’t like the index. I feel that git encourages people to check in changesets that contain code which they’ve never tested (or even built) because the index is such a prominent part of git’s workflow.
I’ve found the index a pain to work with – if I want something like that (and more powerful, too) I’ll use mq. In the mean time – why should I be forced to have different types of
adds, etc.? Why should I be forced to use
git commit -a (and have
git status – where is
git st? – show weird info)?
Quite seriously, I personally can attribute the success and wide acceptance of git to nothing other than GitHub. Steve latches onto that, too. How may people have been through this, and “given in” to pressure from git users?
I don’t like using git itself (though it’s far better than SVN or CVS), but GitHub is such an awesome site that I’ve considered switching just to use it.
I’ll continue to only use git/GitHib when required to – when I want to make a patch to something that’s on there. My own projects will continue to use Mercurial. It feels nicer.
Main reason I use mercurial is because:
- It’s supported at more open source repositories I generally use (namely, Bitbucket and Codeplex)
- It works well out of the box on Windows
Otherwise, as far as the VCS operations themselves are concerned, they’re pretty much the same.
(EDIT: In order to clarify — I’m not saying mercurial is superior — to my understanding Git is faster than mercurial in general use, and I’ve not actually used git that much enough to comment. But these two reasons are why I’m using mercurial rather than git)
No Mercurial and Git are very similar.
My personal opinion is that the differences are highly exaggerated and passionate and do not stand to greater scrutiny.
There are small differences.
Git tend to expose the model more than Mercurial.
Mercurial tends to have a smaller subset of commands than Git and is reflective of that philosophy.
Mercurial has extensions for most other purposes
Most of the other stuff can be achieved by using the powerful extension model in Mercurial. It also has the advantage of easy extensibility as most of the Mercurial code is written in Python and you could run Extensions as if they are native Mercurial commands.
See the following discussion for additional information and details
- What are the pros and cons using git VS Mercurial with Xcode for iOS development in big teams?
The following provides a succinct view of differences between Git and Mercurial
Why, I prefer Mercurial over Git.
[Again a personal passionate and biased opinion]
The commands are truly a subset of what is available in Git and seems very sufficient. Any thing more, it feels like over indulgence.
I prefer git because:
- It (seems) faster to me.
- More built-in tools.
- Higher availability of help, questions, and discussion (even on this site).
- GitHub is incredibly useful.
When I was reviewing DVCS a few years back:
bzr was tied to Python 2.4 and wouldn’t install/run on 2.5 out of the box.
git support on Windows was sketchy at best.
That left hg. I have been very happy with hg. The hg community seems to have an eye towards UX, which makes me, a user, happy. git UX seemed to take a long time to start moving towards “ease of use”, which does not incline me to look favorably upon it.
There are a few things that I think hg needs to have: flexible metadata and big-file ease stand out. However, those aspects do not interfere with my regular use case and if I really need it, I can write/modify extensions without significant grief.
I use Mercurial because code.google.com supports it. I also use it because it is written (mostly) in Python and is easily extendable. It is also easily installed on many operating systems. Some people I work with are afraid of the commandline and like having the ability to use a GUI tool, so I point them to TortoiseHg.
Both have their pros and cons. Use whichever you are more comfortable with.
gitvsmercurial.com via Wayback Machine
Since writing this answer, I have become predominantly a git user, mainly because of GitHub. I have also began using Subversion at work. I would rather not be using Subversion.
6 of one, 1/2 dozen of the other. I switched from Mercurial to Git because another guy on my team prefers it. However, I think he prefers it only because he learned it first.
You can achieve equivalent things with both but that doesn’t mean the differences are superficial.
Having used Git daily for a couple of years, and Mercurial daily for about a month now, I find there is a distinctly different feel to both.
My experience so far is that when collaborating in a centralised sort of workflow, Mercurial makes it more difficult to keep private development branches, without keeping multiple clones of the repository. With Git you have to be explicit about what you share.
So with Git it feels much less of a big deal to do casual hacking; maybe things you “shouldn’t” be doing if it’s a work project, for example. It lowers the mental barrier to trying out a new idea.
Since I like to be able to do whatever I want, on my own copy of the repository, and only share with others what I want them to see (and what is useful to them), I prefer Git because it seems to make this easier.
Another thing: I did get quite excited on first seeing Mercurial’s Python API (since I’m a Python user). I thought I was going to have a great time writing extensions. Then I saw the warnings that the API is not guaranteed to remain compatible.
Since I’m lazy (a noble characteristic I think, having also been a Haskell dabbler at some point), I gave up that thought quite quickly and disappointedly.
Just because there are network effects doesn’t mean marketing decided everything. Git’s toolset is generative and terribly efficient (it’s used in a lot of backup, archival, and data integrity stuff); Hg’s extensions must be generative as well, but more at the level of ui enhancements. Git started some useful standards like fast-import. I think this is why it attracted more system builder types, who are a good seed both for improving git, completing it, and putting their stuff in git.
Historical accident. I started using Git during the very few days before Mercurial was released. I kept using Git because I was too lazy to relearn.
IOW: Mercurial didn’t exist when I started using Git, so I never actually made a conscious decision between the two.
However, there are a couple of things I like:
- every single project I care about uses Git and the few that don’t use Git provide a two-way gateway
- GitHub, Codaset, Assembla, Codebase, Gitorious, Repo.Or.Cz (mob branch FTW), Unfuddle, ProjectLocker, SourceForge, TuxFamily
- the staging area aka. index
- easy access to the low-level “plumbing” (I’ve done some insane stuff that I would have had to write a Python extension for in Mercurial. In Git, I just called the commands.) E.g. I merged two repositories which had no common history, similar to the Coolest Merge Ever.