Any company involved in software development will use a revision control tool. Many of these tools, such as CVS and Subversion, work by storing file differences in a central repository. Over recent years however there has been a growing realisation of the limitations of these tools when compared to Git which, rather than file differences, stores repository snapshots and also provides distributed operation. A number of Abelon’s customers are recent Git adopters, so why are they and other companies making this transition? What practical benefits does Git offer over these older tools?
With Git every user maintains a complete copy of the repository including all history which allows for flexible offline working. When changes are committed a snapshot of the repository is taken along with information about that commit. This provides a high degree of flexibility perhaps most notably when it comes to branching. Using tools such as CVS, branching and subsequent branch maintenance has a high overhead, by contrast Git makes branching relatively easy.
Using Git leads to different ways of working. Take a typical example where an engineer is working on a number of bug fixes in parallel. Using a tool such as CVS the engineer will typically checkout a copy of the code base for each task, storing each in a separate directory. By contrast, with Git a separate private branch is created for each task and a single directory is used. Switching between different tasks involves switching between branches within a single directory with Git taking care of updating the files to reflect the active branch. Since private branches are being used the engineer can commit work frequently thereby getting their work under source code control earlier. These commits can subsequently be squashed into a single concise commit when merging back onto the main branch.
Git, along with the standard GUI or third-party tools, can also be used as a code review tool. Once an engineer is happy with their work they can point their reviewer at their private branch. The reviewer can then create a review branch and annotate the code directly with their review comments. This branch can then be used in an iterative manner until the completion of the review at which point it can be merged into the main branch.
Git is a powerful tool and many are convinced that it improves productivity. At the same time it should be borne in mind that it takes time to learn Git especially for engineers that have used traditional tools such as CVS for many years. Its very power can also lead to problems. Organisations must consider what staff training is appropriate before making the change. They may also choose a gradual approach where Git is used side by side with their existing revision control tool for a time.
There is a wealth of information available about Git. A good starting point is here.