Posts Tagged ‘scm’

A couple days with Git

Wednesday, December 12th, 2007

So my first impressions with Git which I’ve heard some various discussions about in #macsb has been quite good. It’s pretty easy to get started with, specially with the decentralized nature, meaning you don’t need to setup a repository and do the whole import/checkout dance that you have to do with subversion. If I have a project that I want to start versioning, I just jump right in and tell git to fire it up, add all the files (save a few like say build/) and then commit and I’m already versioning.

I always found the starting of a new project with subversion to be a bit confusing and awkward. It involved setting up a repository if there isn’t one, or a new folder in an existing, Importing the project somewhere into the repository, Finally checking out a fresh working copy of the project, moving aside your previous copy of it. There may be some better way that doesn’t involve shuffling your old pre-svn copy out of the way, but its still kinda clunky. From then on it’s not really that bad though.

One of the first things I noticed which was different, but that I actually like, is that by default you have to explicitly tell git what you’re going to commit. You go though and add any new or modified files that you want to be part of the commit. I like this since very often I find myself committing bits and pieces of a project, but not committing every modification I’ve made. In subversion I either have to do separate commits, or specify each thing after ’svn commit’ which is not as elegant as actually marking items for a commit like the approach git seems to take. It agrees with my method of going through a lot of changes and approving certain changes for actual committing.

There’s also some other benefits that I have yet to dive into beyond reading about, but one of the other strengths of git that people talk about, which is branching. Git allows branching in such a simple efficient way that you can easily branch off and experiment with stuff, easily coming back to your stable branch, merging anything that might have been a success. I’ve always found the procedure for branching in subversion to be a bit daunting, git’s in comparison is trivial. Creating a branch in git is literally a single command, making it much more attractive to allow you to mess around, track changes, but easily keep things cleanly organized. This I will definitely have to experiment to see if it really is as awesome as it looks.

I’d definitely recommend giving git a serious look, specially for anybody that isn’t already invested in a particular versioning system. It seems to be a decent fit for an independent developer like myself, and even sounds like it would work well at work if we weren’t already heavily using subversion. Since my personal projects only have me working on them, it works well for me to get going quickly with tracking changes, not having to do the bit lengthier setup that seems to come with subversion.

Check out the Git Tutorial to get a good feel of how git works. See if it may appeal to your way of doing things.