What is Source Control and Why do you Need it?
In this article, we look at what source control is, why you need software versioning and we'll look at some common version control software solutions.
Source Control, also known as versioning, version control, change management or change control, is a set of practices and tools designed to keep application source file versions backed up in a safe place such that any version can be retrieved later down the line. I also allows you to go back in time and view source files at various points in a project's history. Source control systems also offer teams of developers the ability to simultaneously work on the same source files and have each developers tools merged into the master repository.
There are a number of reasons why source control is a very good idea. Source control tracks changes to files over time, so if you break something you can go back through the change history and find out when it was broken, by whom and fix 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 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 have the ability to merge changes from multiple developers.
Commit - As a developer finishes working on a task or tasks, 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 in 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 Applications
There are many different source control application available. The applications are not tied to any particular framework or platform and can be used for any files, 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 on a regular basis.
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 allow 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.
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 formats. 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.
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.
Last updated on: Friday 23rd June 2017
There are no comments for this post. Be the first!