Subversion gits the last train

There has just been an announcement that the Rails-core source code version control repository is moving over from Subversion (SVN) to git and they will be using Lighthouse for bug tracking instead of trac. Does this affect you? Not directly (unless you like playing on edge-rails), but it is a good excuse to talk about source code repositories and some of the differences between subversion and git.

What’s source-code version control?

Source-code repositories provide you with a central place to store your code — they will generally do this whilst maintaining a history of your “commits” (The action of saving code back to a repository). This means that you are able to roll back code any change that you have made. If you have ever been over-zealous with the rm -rf command, you may understand why this might be handy.

Another cool feature is the ability to branch (or take a copy of) your code – this allows you to keep, say, a development and a stable version. If you find a bug that needs patching in your production version, you can merge the change back in to the development branch thus avoiding regressions bugs.

There are a number of version control systems out there, with subversion becoming one of the most popular in recent years. Recently though, git seems to be gaining some traction, especially amongst the Open Source community, because of it local repository features. In subversion, when you commit a change every other users local “working copy” had to be updated to reflect the changes, so if you were experimenting and wanted to save a version, but the changes weren’t quite ready for prime time, you were kind of stuck. Git however, allows you to keep a local repository, which doesn’t affect the public repository until you explicitly tell it to.

Many of the commands used in git are the same or similar to SVN (the names may have changed slightly), for a summary checkout this guide and if you are feeling adventurous, you can sync up a SVN branch with git using git-svn.

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • http://www.twice21.com ParkinT

    “…repositories provide you we a central place…”
    HUH?

    Typo (smile)

  • http://www.magain.com/ mattymcg

    Thanks ParkinT, typo fixed.

  • http://www.dangrossman.info Dan Grossman

    Rails developers just have to be different…

  • http://rollerscapes.net s.stok

    For Windows users u like an Tortoise (TortoiseSVN) option I suggest looking at Mercurial.

    Looks very much like Git, but the only major difference is that is works better on Windows then Git.

  • Jakub Narebski

    For Windows users u like an Tortoise (TortoiseSVN) option I suggest looking at Mercurial.

    Looks very much like Git, but the only major difference is that is works better on Windows then Git.

    First, you can use Git on Windows, either via Cygwin, or from msysGit project. TortoiseSVN alike (shell extension/filemanager plugin) is also in the (currently early alpha) work under the name of Git-Cheetah.

    Second, the major difference between Git and Mercurial is that Git uses multiple branches in repository explicitely and from the start, while Mercurial default is to use one live branch per repository and multiple live branches in single repository are available as extension (plugin) and are second-class citizens. This makes Mercurial initially easier to use. (Well, actually the major difference is the way revisions info is stored, but one usually doesn’t worry about this). Tags in Mercurial AFAIK are implemented in a bit strange way compared to Git; and unchanging tags in either are not “matter of convention” only as in Subversion.

  • phpimpact

    On the other hand, Trac finally meets his competitor ;)