Is git really better than X?

The DVCS craze drives me nuts, especially with regard to git. The big plusses of a DVCS are that it's fast, branching is local and cheap, and it's distributed (i.e., no central repository). Joel Spolsky started gushing over git and Mercurial (hg) not too long ago, and then even built a SaaS app for hg. Everywhere you turn, someone's going off about how great git is. Even the folks running the framework I use the most, Drupal, were not immune to the hype. Maybe it means I should turn in my geek card, but I'm just going to say it: git is the Emperors New Clothes.

I've used hg extensively and git fairly regularly, and there are some things I really like about DVCS. It's true that branching is fast, and it doesn't depend on the network. I really, really like that. It makes per-feature-branching almost seamless, and I dig it a lot. Before hg and git I worked almost exclusively in SVN, and branching was... difficult, to say nothing about the consequent merge. DVCS it lightyears better.

Distributed?

Everything's distributed to anyone who clones now, instead of living in one central repo -- at least, that's what the sales guy down at the lot said. In reality, you're pushing your commits somewhere like Github or Kiln, and any work you do that's not pushed out may as well not exist. When's the last time you cloned or fetched from your neighbor's laptop? Never, that's when. Everything lives in Github, and if your laptop's hard drive goes up in smoke, then the work you committed but didn't push is gone -- just like with traditional version control. Not exactly game-changing.

The Pain of Branching

Branching, while fast, is strange in git. I don't always see all my branches in git log --all. I think you only see branches that are tracking the origin, but I thought the point is that you do all your work locally...? What's the point of only seeing remote branches in the log? Speaking of tracking, how do you push a new branch and make sure you always pull from the remote copy as well if you didn't create the branch to track origin? Hg actually was really good at this: hg push --new-branch and you're done.

The result here is that I never feel like I've got a solid grasp of where, exactly, I am in relation to my branch point. Once in a while I'd get similarly lost in hg and push up to Kiln, and take a look at Kiln's awesome train tracks display to pinpoint exactly where I was.

Why Git is Better than What?

A lot of people harp on how fast git is. In fact, the author of "Why Git is Better than X" went so far as to encourage the reader to try for himself:

These numbers are really not difficult to recreate, simply clone the Django project in each of the systems and try out the same commands in each.
git clone git://github.com/brosner/django.git dj-git
hg clone http://hg.dpaste.com/django/trunk dj-hg
bzr branch lp:django dj-bzr
svn checkout http://code.djangoproject.com/svn/django/trunk dj-svn

Sounds good, let's give it a shot:

$ time svn co http://code.djangoproject.com/svn/django/trunk/ django-svn
[...]
Checked out revision 17495.

real 0m33.704s
user 0m4.209s
sys 0m9.555s

$ time git clone https://github.com/django/django.git django-git
[...]
Resolving deltas: 100% (104179/104179), done.

real 1m30.075s
user 0m6.376s
sys 0m2.369s

Huh. In fact, git's performance on truly large repos is pretty dismal, to the point where Facebook's taken to the message boards trying to figure out what to do. The git community's answer so far has been "you should break out your code to multiple repos." Nice.

The Learning Curve

All that aside though, by far my largest complaint -- and this is git-specific -- is the learning curve. I know there are some folks out there who are ridiculously good at bending git to their will; Ben Hoskings' Advanced Git screencast is a great example of are-you-a-wizard levels of git usage.  At this point, I've all but given up all of that. I've actually just installed the gitflow extensions and called it a day because I'd rather spend my time doing Actual Work than trying to learn the arbitrary conventions of the flavor-of-the-month vcs. It honestly shocks me that I don't see more vocal complaints about this, but I think that's because most git users fall into two camps: those that work on solo projects and perhaps occasionally merge a pull request through github, and those like Ben Hoskings who are just wizards. Git doesn't leave a lot of room for the middle ground. I've personally known two very strong developers who successfully used git solo just to have it blow up in their face as soon as they started collaborating.

Bottom line: I'm feeling the pain right now. Maybe in a year I'll join the rest of the world and write another post about how great git is, who knows. But from where I sit today, it seems impossible that the hordes of people wringing their hands over the awesomeness of git have it right. Maybe I look like a fool for saying it, but I can't see any clothes on the emperor at all.

Comments Join the discussion...

I am new to git and have been

I am new to git and have been skeptical about hypes online as well. However, from a company where people are still using IBM's Clearcase, Git is definitely a lot better. Besides, I think some of the problems are at the very limit of SCM. Using some other tools together will be more productive. For example, the problem you mentioned about backing up your code, some people use Git together with cloud storage solution to solve that issue. As for a really really large repo, managing a large system is a challenge way beyond just performance. I believe the guy's suggestion is beyond whether you can play with 15 gb of source files efficiently, but whether it's even practical to coordinate. It's like making a large apartment building like making a sculpture, while it is certainly a very challenging and artistic feat, it is not preferable to engineers because it isn't how we normally approach super large projects. So the question is, is it better to find a way to cut marbles faster, or is it better to break a big project into components?

What a minute, you're being

What a minute, you're being deliberately misleading here. The timing example you give, git clone vs svn checkout, is the one and only operation that git does not win by a country mile (often by several orders of magnitude), and for obvious reasons: git clone retrieves the entire project history, not just a single version like svn. Once you done that, in git, you're sweet; all future interactions with the remote repository(s), on any branches, involve small incremental updates and will be *fast*.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <embed> <blockquote>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <c>, <cpp>, <csss>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. The supported tag styles are: <foo>, [foo].

More information about formatting options