What is Source Control and Why You Should Use It

What is source control and why you need software versioning to manage your source code repositories. We look at some version control apps.

By Tim Trott | Software Engineering | March 10, 2008
966 words, estimated reading time 3 minutes.

Source Control, also referred to as versioning, version control, change management, or change control, is a collection of practises and technologies aimed at keeping the source code of applications backed up in a secure location so that any version can be retrieved later. It also allows you to go back in time and view source files from various periods in the history of a project. Source control systems also allow teams of developers to work on the same source files at the same time, with each developer's tools integrated into the master repository.

There are several reasons why source control is a good idea. Primarily, source control records changes to files over time, so if you break something, you can look through the change history to see when it was broken, who broke it, and how to remedy the problem. It provides a means by which your application can be versioned, with each release having its own source control "branch". We'll cover these terms below. It offers synchronisation between developers, meaning that all developers have access to the latest version of the files, regardless if they are working on them or not. This is vitally important in continuous integration projects where all developers work on the main trunk.

There are numerous source control systems on the market, some free some not. We'll have a look at some of the popular systems later on but for now, I want to cover some of the terminology used and give some examples.

  • Repository - The location that source files are stored in. This could be on the file system, or in a database or some other method of storage.
  • Trunk - Sometimes called master. This is the most current stable version of the source code, usually the current build.
  • Branch - A working development version of the trunk with changes, updates and modifications from developers either complete or incomplete.
  • Merge - When a branch is complete, i.e. the development phase is complete, the branch is merged into the trunk so that the trunk is now the current updated source code.
  • Get Latest - Downloads the latest version of the file(s) to the developers machine.
  • Check-out - When a developer wishes to work on a file, they check it out. Some systems place a lock on this file so that other developers cannot make changes, while some more advanced systems can merge changes from multiple developers.
  • Commit - As a developer finishes working on a task or task, they will commit their code back into the branch.
  • Changelog or Changeset - A note of every check-in made, along with a list of the files changed and a message from the developer checking in the code.
  • Merging - Combines the changes of two developers into a final modified file. This can be automatic, semi-automatic or manual using a diff tool.
  • Fork - Similar to a branch, however, forks are entirely new copies of the trunk and are intended to remain separate.

As an example, imagine that on a working day, James may wish to make a change to a file. He will check out the file for editing, make his changes and then commit that change back to the repository. Later on in the day, or the next day, Amanda gets the latest version of the project. This includes a change that was made by James and any other changes other developers have made. Amanda can view the changeset and see what changes were made by James. Each time a file is checked in, we get a new revision or changeset.

Source Control - Checkin/Checkout Process
Source Control - Checkin/Checkout Process

Source Control Applications

There are many different source control applications available. The applications are not tied to any particular framework or platform and can be used for any file, not just source code. You can use them as a change control for documents, graphic design libraries, source code, and any other file that is updated regularly.

Source control applications are not tied to language either, so even though Microsoft Team Foundation Server is aimed at Visual Studio developers, you can use it to check in PHP, Ruby, Java, Word, Excel, Photoshop, Illustrator documents, you name it.

Microsoft Team Foundation Server (TFS)

Team Foundation Server  (TFS) is a Microsoft product that provides source code management. While it can be used with numerous integrated development environments, it is tailored for Microsoft Visual Studio editions which allows for the full development life cycle to be managed. TFS comes in two varieties - self-hosted and a managed online solution. Both systems can either use their own database and repository architecture, or they can integrate with GitHub as of TFS 2013.

SVN - Subversion Source Control

Apache Subversion  (SVN) is a software versioning and revision control system distributed as free software under the Apache License. SVN is primarily a tool used by PHP developers, however, like TFS it can be used with any source format. SVN is heavily used in projects such as Apache Software Foundation, Free Pascal, FreeBSD, GCC, Mono and SourceForge. Due to its open-source nature, there are ports of the server and client for almost every operating system configuration, including Windows, Linux, Mac OSX, Android and many others.

Source Control with Git and GitHub

GitHub  is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Unlike TFS and SVN, Git uses a working directory which is a fully-fledged repository with complete history and full version tracking capabilities, independent of network access or a central server.

Was this article helpful to you?
 

Related ArticlesThese articles may also be of interest to you

CommentsShare your thoughts in the comments below

If you enjoyed reading this article, or it helped you in some way, all I ask in return is you leave a comment below or share this page with your friends. Thank you.

There are no comments yet. Why not get the discussion started?

We respect your privacy, and will not make your email public. Learn how your comment data is processed.