This week, I’ve been looking at Git. Git, if you don’t know, is a distributed version control system. I really like Git for one reason – local branches. I really, really, really, really, like the reality of having a local branch that I can commit to without having to go across the network. I’m stingy. I like my own sandox of code. I like working with my own snapshot of a source tree to do whatever I want with it. If my changes are good, I can commit them back as a coherent change set. If they suck, I can roll them back and no one will ever know what I was up to. The reality of local branches gives me the ultimate in flexibility.
I was once in pretend land where I though that SVN gave me the same flexibility. However, I needed to create branches on the repository, then check the branch out, then switch to my newly created branch, then check my changes back into the newly created branch. Finally, I need to merge between branches. This is okay for changes that are long lived (more than a few days at least…). For example, I’ve worked on stories that span more than a few days. Since I like to experiment, I would branch the trunk and work on something experimental, then merge in my changes with the trunk. This is status quo for SVN users. Textbook examples of using branches…. When I was satisfied with my work, I would merge my changes back into the trunk and life would go on. Life was good, so I thought…
The problem is that branches are expensive in SVN. I need to do a lot of work to materialize a branch. It’s also visible to everyone. What if I wanted to work out something non-trivial? Does everyone need to know that I’ve branched the trunk to work on story “xyz”? Further, I need the network to branch. I can’t do it without a connection to the repository. Kinda sucks if I’m on a plane or at Starbucks with a crappy wi-fi connection!
What if I’m working on a team with several developers on the same feature? I need to commit back to the mothership (SVN repo) in order for my changes to be visible to other committers. What happens if I only want to work with a subset of the team on a specialized sub-feature? The very nature of commit -> publish -> update model disallows this.
So… Where does this leave me? Well, I can’t shift the organization to a git repository. That would require me swimming upstream. There are way too many SVN users in the crowd and I think I’m the only one who would entertain git for practical usage at the moment. Perhaps there are others, but I haven’t heard any rumbles.
I’ve retreated to wrapping my mind around git and the integration with SVN (git-svn). So far, the learning curve is rather steep. Specifically, I’m having trouble wrapping my brain cells around gits ability to rebase. I’m pretty satisfied with happy-path workflows using git and svn. However, when I get into conflicts or I need to re-examine my git index, I get into la-la land. I’m much more comfortable than I was last week; however, I’m still not confident in my git skills.
The take away… Local branches are the right way to go. There should be no reason why I need to connect up to the repository to do feature work, experimental work, or hot fixes. In my opinion, the very nature of software development requires that code should fork from a stable basis in order to evolve. It doesn’t have to follow lock step with a repository commit in order for it to be useful. Once changes satisfy a need, they can be committed back to the mothership.
Git speaks to my heart when it talks about local branches and I’ve been looking for such a workflow for some time now. SVK seems to support local branches with the promise of speaking SVN, but its still SVN under the covers. If I’m going to exhause brain power on managing local branches, I might as well commit to a tool that does it as a cleanly as git.
Bottom line… Git is the new hotness for me. The learning curve is steep and its going to take me some time for feel as comfortable with it as I do SVN. SVK is a non-starter for me. If anyone has a decent workflow for git-svn, let me know… I’d be interested in trying it out. Also, if anyone knows of any other tools that let me whip off local branches for later commits back to a repository, let me know. I’ve found none thus far – other than bitkeeper, but Linus already told me that