I’ve been noticing a heavy upheaval in the source control world of Ruby on Rails: and the spotlightis on Git. So Git, what gives?
Introduction to Git
If you don’t know what Git is, it’s supposedly the next best thing for source control, just like SVN was to CVS. It was originally created by Linus Torvalds, the same guy who brought you Linux1. Git is most notably used for the Linux kernel.
Things to note
There are a couple things that I’ve read that are supposed to make Git very powerful, which I somewhat agree with, but at the same time don’t understand:
- Speed: I don’t have any graphs on me, but ones that I’ve seen show it being mega-folds faster than all version-control systems. This is especially shown when dealing with thousands of small files (Like most open-source projects). Of course, when looking at the graphs, the critism around them was that they were showing results on ‘old versions of the version-control system’.
- Superior Branching Capabilities: This is the only one I truly understand and absolutely give Git credit for. As you all probably know, branching in SVN is an incredible pain. In Git, it’s as easy as 1, 2, 3. I’d provide an example if I knew it off the top of my head, but I’m sure someone will comment on this for further insight.
- Distributed Repositories: This feature is probably the biggest feature of Git itself. When you get code from a repository, that code you checked out is actually a full repository itself. What does this mean? That potentially means anyone can pull the repository from you. This feature is what I don’t understand, why do you need distributed repositories? Why would you need something other than a central repository with read/write access? Maybe I’m just so used to the subversion workflow that I just don’t understand why a distributed repository system would be useful. There is one small thing, and I’ll mention that on the next bullet.
- In relation to above, when a user checks out a repository, they are given a full repository themselves; this leads to an amazing benefit: they get to commit locally without syncing with a central repository. That means you can be offline and still commit your code and have it logged.
That’s the basic understanding I have of Git, and obviously you can see I’m a bit confused and don’t really understand why it’s overly superior to SVN and other version-control systems. I’ll give it props for being faster, and easier to branch off of, but that can happen in Subversion as well with an update. Another thing to note is that if your current project is using subversion you could potentially use Git as a wrapper, which gives you access to the local repository features, but I don’t think it’ll be any faster because it’s still a hook to SVN commands. One other downside to using Git as a wrapper for SVN is that all the commits you made with Git will not be pushed into one big commit in Subversion. Here’s an example:
Dave, your ever-so-loving coding partner who uses Git instead of Subversion to be the cool developer on the block, somehow committed 500 changes in less than a minute! This changed the subversion change-set from 500, to 1000 in less time than it takes the big hand on the clock to fully turn!
Hopefully you understand that example. I personally dislike Git on Subversion projects for the above example’s outcome. I actually use those change-sets as a milestone in my mind of how things are progressing, if it changed 200% in one minute, it would really throw off the point of a change-set.
So, in summary: Git is superior in branching, and for the most part, speed. But, why Distributed Repositories? I hear it can be useful in open-source projects, but I really have no idea why, and why would this be useful for closed projects as well?
I’d really appreciate if anyone can shed some light on why it’s otherwise superior. I love to stay on top of the best technology, so kick my ass on my lame knowledge and educate me! Then I’ll be able to convert my team to Git :)
p.s a lot of Rails projects are popping up on http://github.com/.