Now I git it!

I’ve been using Perforce daily for 6 years now, and I’ve also used Subversion, Rational ClearCase and Visual SourceSafe. I’m quite proficient and comfortable with Perforce, even though it still drives me mad sometimes; but after two days of using git properly, I never want to go back to anything else.

I know I’m late to the git bandwagon, but until recently I had never tried it. When I did try it for the first time a few months ago, I just didn’t get it. Years of traumatic experiences with merges and integrations on large projects that took days (if not weeks) had left me with a deep-rooted distaste for branching. And so I instinctively avoided doing any branches, and never even bothered to learn how they work in git. I used git like it was just another Subversion, and totally missed the point.

To make matters worse, my first encounter with git was also my first Unity project. The Unity editor barfs out a ton of binary files with random alphanumeric names. You need to purchase Unity Pro to get external SCM support (although they would prefer you buy and use the Unity Asset Server). Without Pro, using git with Unity is not very fun, but apparently there are some ways around it. In the end, the project was put on hold and the git experiment abandoned.

Recently I started a new C++/Xcode project and gave git another go. This time I decided to learn to use it properly, because I felt I must have missed something. Indeed, all it took was a 20 minute tutorial, and after I had made my first couple branches and merged them back, I was sold. Git is very easy to use by command-line alone, but on OSX I also sometimes use Gity for a pretty UI.

It turns out branching is infinitely useful when it’s not also a huge pain in the ass. I now make branches for every feature or side experiment during development. I thought Perforce shelving was the greatest feature ever, but git branches make it look like a hacky workaround. The rest of the git advantages like being distributed and working offline finally clicked as well. How did I work without this?!

I’m sure there are many developers out there like me who’ve only been exposed to the likes of Perforce for all their careers, and never had reason or motivation to try an alternative. But give git a chance, learn to use it properly, don’t shy away from branching due to your traumatic past, and you’ll see what all the hubbub is about. And if you’re feeling like a true computer science nerd, you can read about how git works under the hood.

The unfortunate part of all this is that I still have to use Perforce every day at work and now I know what I’m missing. Oh, the burden of knowledge!

 

26. October 2011 by ehsan
Categories: dev | Tags: , , , , | 3 comments

Comments (3)

  1. I’m looking into how git could be effectively used with Perforce. See: http://blog.perforce.com/blog/?p=7113 Suggestions, comments?

    • Yes I could see how it would be useful to mix them, but I haven’t tried. The main advantage I see, especially for large teams, is that the workflow becomes closely tied to the logical structure/hierarchy of the branches, which are themselves going to mirror the structure of the teams. I imagine coming up with processes for dealing with logical branches would be easier than dealing with atomic changelists from all over the place.

  2. Just found a much more advanced Git visual client for Mac from Atlassian called SourceTree. It’s free for a limited time. Thanks to @IcyMidnight for the tip. http://www.sourcetreeapp.com/

Leave a Reply