Ayende @ Rahien

Unnatural acts on source code

Git is teh SUCK

Today, I had two separate incidents in which my git repository was corrupted! To the point that nothing, git fsck or git reflog or git just-work-or-i-WILL-shoot-you didn’t work.

The first time, there was no harm done, I just cloned my repository again, and moved on. The second time that it happened, it was after I had ~10 commits locally that weren’t pushed. I had my working copy intact, but I didn’t want to lose the history. I asked around, and got a couple of suggestion to move to mercurial instead, because git has no engineering behind it.

Based on that feedback, I …

Oh, wait, it isn’t this sort of a post.

What I actually did was setup Process Monitor and watched what git.exe was actually doing. I noticed that it was searching for a .git/objects directory, and couldn’t find it anywhere in the path. Indeed, looking there myself, it appeared clear that there was no objects directory under the .git dir. And checking in other repositories showed that they had it. So now I knew why, but I still had no idea who the #*@# decided to randomly @#$%( my repository, totally derailing my productivity.

That is where having multiple personalities come in handy, he did it. The one that isn’t writing this blog post, at some point during the day, there was a need to zip the repository and send it somewhere. Since the working copy is full of crap, that idiot issued the following:

ls -R obj | rm –F

ls -R bin | rm –F

(Not the exact commands, the idiot used the UI to do a search & delete).

You can guess the following from there. At this point, having come to this astounding discovery, I heroically went to the recycle bin, found the objects directory there, and rescued it! All is well, except that there is still a thrashing for uncommon stupidity owed.

And remember, it wasn’t me, it was the other one who did that!

And yes, the spelling mistake in the title is intentional.

Comments

Dennis
03/03/2010 06:10 AM by
Dennis

haha :)

Max
03/03/2010 06:28 AM by
Max

Why not to zip new clone of the repo (all crap should be in .gitignore already)

Set
03/03/2010 06:51 AM by
Set

Shift delete is more fun

Steve Py
03/03/2010 07:16 AM by
Steve Py

hehe, Oh yeah, Shift+Del is teh fun... :)

Leon Breedt
03/03/2010 07:25 AM by
Leon Breedt

Heh!

I've done that on OS X

$ rm *;o

zsh: command not found: o

$ # fuuuuuuuuu

Max
03/03/2010 07:39 AM by
Max

Try "git clean" instead.

configurator
03/03/2010 08:03 AM by
configurator

That's why I use total commander and always search for the exact regex ^bin$|^obj$ .

That said, Mercurial is incredibly better than git. I became a Mercurial fanboy the moment I started using it for the first time.

BjartN
03/03/2010 09:01 AM by
BjartN

Kudos for discovering the problem ;)

ArnisL
03/03/2010 10:06 AM by
ArnisL

Talking about shift+delete...

It's nice to configure recycle bin (right click->properties->some checkbox) NOT to ask confirmation on deleting something and develop a habit to use del instead of shift+del.

Jan Limpens
03/03/2010 02:47 PM by
Jan Limpens

@ configurator

i am using hg, too and also think that is a lot friendlier than git which has a certain stoneage flair to it :) - but it does not shield you from your stupidity.

I once applied a grep action on a solution directory, forgetting to exclude the .hg from it. Well, needless to say, I completely foobar'd my working copy holding a full day of work. It took a lot of sweat to rescue some of that...

Alex Yakunin
03/03/2010 03:52 PM by
Alex Yakunin

So I got few more reasons for my initial assumption: Hg rules, Git sucks (details are here: blog.alexyakunin.com/.../...or-do4-git-versus.html ).

Btw, so far I didn't face any real issue with Hg - even although we have a pretty complex case with migrating changes from Subversion repository to it.

Kalyanov Dmitry
03/03/2010 07:53 PM by
Kalyanov Dmitry

Just a note: if you need a zip/tarball of tree, you can just use 'git archive'

Adam
03/03/2010 09:36 PM by
Adam

Wow.. Hg fan boys :) I think VSS is easy to understand :)

Andrew
03/03/2010 10:05 PM by
Andrew

Yeah 'git archive' sounds like subversions 'svn export' feature - you can checkout a working copy without all of the .svn/.git folders.

Alex Yakunin
03/03/2010 10:38 PM by
Alex Yakunin

@ configurator

I became a Mercurial fanboy the moment I started using it for the first time.

The same with me, and few more persons I know. It seems the best answer to some Git fans is "just try it - I'm sure you didn't".

Hmm, they immediately dropped few hateful comments in by blog :\

Adam
03/04/2010 12:42 AM by
Adam

git is faster, more flexible and more powerful. It's the old UX problem of easy to use vs. more productive. For some git is better, for other hg is better. End of story.

Chris Smith
03/04/2010 03:13 PM by
Chris Smith

It doesn't matter if it's faster, more flexible and more powerful if it destroys your repository periodically.

Like I said the other day: Mercurial saved me after Git fell over on me.

Comments have been closed on this topic.