Macha

Source control and me - Why I use git and github

December 29, 2009 | categories: Pcs, Programming

The biggest change to programming for me this year (apart from spreading out from just PHP and Javascript) is that I now use source control for most of my projects. I started out on subversion because it was widespread, easy to use (with TortoiseSVN, I was still a Windows "everything must be GUI" user at the time), and there was a handy tutorial for it published for it on a blog I happened to read. I used that for a good while until a friend showed me git and github. I'd used Sourceforge and Google Code for a while, because although my projects are too small for anyone else to be interested in adding to them, the benefits of having a remote source control service that's always accessible from any computer are huge for me. And it's handy for showing people the program in more detail if I need help on Stack Overflow.

While I was (and still remain) unconvinced about the benefits of distributed source control versus normal source control, and more specifically of git vs svn, the benefits of github versus google code (which I had been using at the time) were more than enough to convince me to make the switch. It also helped that at the time, Linux had recently become my main OS with Windows being relegated to usage for syncing my iPod Touch and gaming, and I had become much more familiar with CLI usage of the system, so the command line orientation was no longer the problem it once was.

Branch history of a small github project

Look at the pretty graphs! (ignore Chromium for Linux's fail at positioning. My cursor is actually on that big green dot on my screen. It's just the screenshot gone wrong. This is the fault of

Setting up git and github was simple. I could give you instructions on how to do it, but Sirupsen has already done this much better than I could for Linux users. For Windows, there is another tutorial hosted on github,

Usage of git with my github account is equally simple.

  • Change files
  • git commit -a
  • Type commit message into nano (or vim if you've changed your system editor, or notepad if you're on Windows)
  • git push origin master

The only thing I missed during switching was that Subversion numbers revisions like 1, 2, 3...20000 while git uses md5 hashes. But I can live with that.