Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do you use Git over Mercurial? (Or vice versa.) [closed]

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.

like image 992
iconoclast Avatar asked Nov 28 '10 22:11

iconoclast


People also ask

Should I use Git or Mercurial?

Git Is Better for Experienced Users Mercurial depends on your level of technical expertise. Mercurial may be safer for less experienced users, but Git can offer ways to enhance safety (once you know what you are doing).

What are the advantages of Git over Mercurial?

Git has a powerful and effective branching model. Branching in Git is better than Branching in Mercurial. Branching in Mercurial doesn't refer the same meaning as in Git. Git supports the staging area, which is known as the index file.

Why is Git so widely used?

One of the biggest advantages of Git is its branching capabilities. Unlike centralized version control systems, Git branches are cheap and easy to merge. This facilitates the feature branch workflow popular with many Git users. Feature branches provide an isolated environment for every change to your codebase.


2 Answers

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.

like image 98
Chris Morgan Avatar answered Oct 10 '22 16:10

Chris Morgan


(A) Top 3 real reasons I use Git rather than Mercurial by choice:

  1. historical stochasticity / inertia
  2. historical stochasticity / inertia
  3. historical stochasticity / inertia

(B) Given the above, the top 3 things I like about Git over Mercurial:

  1. the index
  2. lightweight branches
  3. 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:

  1. 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)
  2. 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?)
  3. 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.

like image 33
Jeet Avatar answered Oct 10 '22 15:10

Jeet