In my quest to try and learn new things (more like trying to avoid being bored with stuff I’m doing) I decided to take a look at another version control system I had heard about called Git. According to it’s entry over at Wikipedia it is “..a distributed revision control / software configuration management project created by Linus Torvalds.” Yes, the same Linus Torvalds who created Linux. When I first heard about Git I thought to myself “why should I care that Subversion supposedly sucks and that distributed version control is awesome?”. So I decided to dig a little further.
I found this video of Linus talking about Git at Google and while I did laugh at Linus’ professed hatred for all things CVS (and it’s hip descendant SVN) I did grow to understand git. Basically, he created the version control system *he* wanted to use for the Linux kernel after his experiences with BitKeeper led him to stop using it, but there was no way he could go back to the old patches-and-tarballs way they used to maintain the Linux kernel. Just too many people using it now I guess. So, he hit on the idea of using a bunch of existing tools, hacking them together with some glue of his own and creating a distributed version control system that he could use on a daily basis.
Linus had a problem with CVS/SVN because of a few things as far as I can tell: branching and merging was terrible (I agree that branching and merging is not the easiest thing to do in SVN if you get to any level of complexity) and he disagreed with the ‘you need access in order to commit things’ model that CVS/SVN promotes. As someone who has commit-level access to the CakePHP repository, I can understand why that bothers some people: once you can commit stuff you can wreak a lot of havoc with bad commits.
My understanding of a distributed version control system is that anyone can grab a copy of the repository and start playing with it locally, making their own commits. Once they are happy, you can then push those changes up the chain to where yo u originally got them from and then continue merrily on your way. The people who are working off of the source of your ORIGINAL checkout can then choose to pull your changes into their working copy whenever they are ready, and so on, and so forth. I hope I’m not oversimplifying things here, and Linus does a really good job of explaining this in the talk.
The main advantage seems to be that it’s greatly increased the speed at which merges and commits can happen. Also, because you have a copy of the entire repository at your fingertips you don’t need to be connected to the net in order to commit stuff: the commits happen locally and don’t go anywhere until you execute a git-push, which sends those changes back to the original source of your checkout. Randall Schwartz, who gave a follow-up talk about git talked about how nice it was that he could do stuff on his laptop on the plane, committing and reverting changes locally.
So, I installed git both on my laptop and my VPS that hosts this blog and decided to try it out. After fumbling around in the documentation for a while I figured out how to (a) create the repository, (b) how to get a copy of the repository, (c) how to commit and revert things and (d) how to push those changes back to the main repository. Really, not that much different from how I use SVN these days…except I think it’s neat how I can do local commits and know that if someone else was working on the project, they could mess around locally committing things and not run the risk of accidentally blowing something away. Maybe I need to get another developer involved in the projects I’m trying out with git to see how this stuff will work.
So, right now I’ve got the IBL web site and Rallyhat using git. No complaints, and I really do see how fast the commits and updates (in this case git-commit and git-pull on the servers where the projects are in production) are compared to SVN. Of course, I’ve automated deployment of these projects using Capistrano.
Now, don’t take my word for it but I really think that distributed version control systems are a great idea that is starting to gain traction. The Linux kernel uses it, and I believe the KDE project is using it as well. I suggest you do what I did before I decide to actually use it: watch the two videos I mentioned above, do some research into how distributed version control systems should work and then actually try it out. You might be surprised.
Tags: Chris' Brain, distributed version control, git, Linus Torvalds

Seems to be similar to darcs (http://darcs.net/).
Hey Chris,
Funny thing, I just decided to picked up git again today. I had decided to learn it a few months back but got sidetracked. I’m determined to have (at least what I consider) a deep understanding before I and my team-members start using it heavily. I can’t accept only knowing commit/push/pull/clean/rebase — I’ll get to where I’d like to be soon though.
These four links will probably prove useful for others embarking on the svn-to-git path:
http://git.or.cz/course/svn.html
http://www.flavio.castelli.name/howto_use_git_with_svn
http://utsl.gen.nz/talks/git-svn/intro.html
http://wincent.com/knowledge-base/Migrating_Subversion_repositories_to_Git
Cheers!
Travis
Another extremely useful tool is SVK. It’s built on top of the svnfs storage system and will sync with SVN, CVS, etc. With it, I can create a local copy with as much of the repo history as I want, create a local branch, and do whatever I want while tracking those changes without touching the original. When they’re ready, then I can merge them back with the original, if I have commit access to that repo. That is the biggest difference between it and Git is to push changes back to the repo, I have to have commit access to it.
Personally, I’ve yet to run into SVN branches being a pain and I consider myself a pretty prolific brancher. My branches don’t generally live very long, but if I have a feeling I’m going to break something while I’m trying an idea out, I throw everything in a branch, then merge it back or delete it when I’m done.
@Travis Swicegood
While I’ve done my best to maintain good branching practices myself (Pragmatic Version Control with Subversion is my version control bible), I’ve been in the situation where the branching has gotten out of control in CVS, and merging becomes very difficult. While branching in SVN *is* easier than in CVS, the real problem is developers not understanding the flow of version control and how to properly solve the problems that occur when you merge.
We’ve set up a service for private git and bazaar project hosting: http://xerophyte.net, as before now, those two popular distributed versioning systems didn’t have anyone providing non-public-access project hosting (to my knowledge).
I enjoy using both. And find that finer grained commits get pushed by the developers on our team because of it.
Yeah git is awesome! I use it for about 5 moths and i’m completely in love. Good to see another baker using it
For people that are new to distributed VCS I’ve stumbled across a good article :
http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated/
@Walker
bookmarked – now I’ll have an url to point people looking for git project hosting.
Hey Chris… wondering how your experience with git has been up to this point now that some time has passed. I’m also wondering whether you found a dmg distro, or did you build from source?
Cheers.
@Brent
My experiences with git have been good so far. Once I took some time to learn the basic commands and the basic workflow (git-status, git-commit, git-push to get my changes back to the main repository) I’ve been using it just fine for my personal projects.
As for building git, I installed it on my MacBook using MacPorts. Nice and easy.