An introduction to Version Control Systems

All experienced software developers know that despite our wishes, some of the lines in new code might break some existing functionality or might even introduce a bug - in software engineering lingo, it is known as regression. Many developers use backup and manual copying to deal with the eventuality of regression - but there is a limit to how many backup copies you can keep. Maintaining such improvised backup versions can become tedious and a source of confusion in itself, especially for large and complex projects with frequent changes. The problem gets compounded with each new developer added to the team as it is not only your work you may overwrite but the work of your team members as well. With deadline looming, this might even escalate a situation with client or your own colleagues :(

Version Control System or VCS is an effective tool for managing different versions of code - whether those versions have been created by you as a sole developer or by a large team of developers scattered all over the globe - very common for open-source projects. In layman terms, VCS is a software with the specialised job of preserving the older versions / files while being overwritten and maintain proper records for quick tracking. We can restore our old versions / files and use them without confusion - even after years. VCS not only saves you the hassle of manual backup / copying and maintaining these copies but keeps track of which team member changed what, line-by-line allowing us an opportunity to work in an organised and responsible manner and concentrate better on our real job, writing better programs.

Concurrent Versions System, Subversion, Git , Mercurial, Bazaar, Bitkeeper etc. are all examples of VCS. All open -source software projects use some VCS or the other - these keep code contributions of dozens and frequently hundreds of developers in sync day and night. CVS being one of the oldest systems is being used by more mature projects like Moodle and Drupal. Subversion which is also referred to as SVN is the VCS for PHP and Ruby. Git is being used by Linux and MySQL projects.

A VCS uses certain files and data structures, known as repository, for storing and tracking the different versions and history of code. If this repository is only available on a central server, then it is a Centralised VCS. In case of Centralised VCS, the user has a working copy which contains the last downloaded version of the code and user's local changes. For looking at older history and versions, user has to access the Central Repository over network. On the other hand, if every user has her own local repository locally, then this arrangement is called Distributed VCS. Distributed VCS has the advantage that even in case of unavailability of network, many tasks can be performed on the local repository in offline mode.

Both CVS and SVN are Centralised VCS, whereas Git, Mercurial, Bazaar and Bitkeeper are all Distributed VCS. Distributed VCS, especially Git, are becoming very popular and there is a possibility of both Moodle and Drupal moving over to Git.