Git in (mild) anger
Last weekend I wasn’t feeling so good due to a bit of a cold. As I manage more than I do these days I don’t often get time to code. Interestingly I’ve noticed a bit of a trend that I code more when I’m feeling ill. I don’t really understand it, but as long as my brain is working and my body doesn’t feel like doing much I suppose it’s nothing to worry about.
On to the main point of this post. My company is currently using Subversion as its source control mechanism. I’m pretty sure I want to change this to something better. I have the influence and power to be able to enact this change, potentially overnight if I REALLY wanted, but that would be as successful as flying to the moon in a sherbet-powered watermelon.
For a start, I’m not 100% sure of what ‘better’ would be. We’ve had a small grass-roots movement trying different types of DCVS for a while. Basically this meant Mercurial and Git. Git seems to be winning out at the moment, and its got to be said that the git-svn seems very solid.
I’ve been tracking svn using git-svn for a while – I might not ‘do’ so much any more, but I know the answers to lots of things and need the code to refer to. But last weekend was the first time I’ve used Git in anger. So, I set about tidying and refactoring a set of unit tests that are horribly coupled to a large chunk of the system – and are slow because of it.
What a difference Git made to my work-flow! Edit, compile, re-run tests, COMMIT, edit, compile, re-run tests, COMMIT. I was committing many, many times more than I ever would have with Subversion. Even if I had my own Subversion branch to isolate my changes, the time to commit over the network would have stopped me doing it so often. Git was a breath of fresh air. Knowing I could just do my work and commit as part of my workflow was very liberating, confidence giving and really quite enjoyable. At the end of the session, I simply ran ‘git svn rebase’ re-ran my tests and ‘dcommit’ed back to Subversion.*
I have a longer term plan to get a GitHub style development system internally at work and this experience has encouraged me tremendously. So much so that this long-weekend I installed gitorious and gerrit on a VirtualBox VM to give them a test drive.
Anyone else changed from Subversion to Git? Got any pointers or war stories?
* Actually I got a little help from a colleague to move my changes onto a git branch so then I could merge/squash them before committing. Thanks for the help and learning Mehran.
Related posts:
July 6th, 2011 at 11:53 am
One of the nicest things about Git is that you don’t need to branch first. You start making changes the way you naturally do. And if, after a while, you think the changes are getting out of hand, or you need to experiment a few approaches, you can create a branch and move your changes to the it. With Git, source control is not yet another concern. You don’t need to think about it before hand. It happens naturally during the process.