The Basics of Version Control in Web Development
- 5 minutes
Web development is rarely a one-person job. It is a very collaborative space, often involving many people in all forms of design and development, from the primary coder, database manager or the front end designer. When building these kinds of projects, with many people working on them at the same time, and probably in the same pages, version control has never become so important.
So what is “Version Control”?
Version Control (aka Source Control or Revision Control) is the management and control of a project. Particularly in the web space though, version control is software that stores, tracks, and updates changes made to a master copy of the project that multiple people might be working on.
How does version control work?
Version control has a number of different strategies that can be used when managing the source files.
File locking – File Locking is a method of ensuring that no two people can be modifying the same file at the same time. One developer will “check out” a file and the system then prevents any other user from checking out that same file until the first developer checks it back in. This method can have its limitations, but effectively prevents overwriting someone else’s work accidentally.
Merging – Merging is a method that does allow multiple people to check out the same file at the same time. It then compares the changes made between each file (after the first developer has checked it in) and allows multiple options on how to then combine the changes from the second file into the first, such as allowing the changes from the first file to remain in the file if overwritten by the second.
As you can probably imagine, this a significantly more delicate type of version control, and can result in errors in the source files. However, the flexibility afforded by this type of version control means that many people will take the risk.
Additionally, version control employs atomic actions. Most important of these is the commit function. This is what a user does to tell the version control software to take their changes and apply them to the source. Before the commit action is executed, the source control remains in an unchanged state.
Finally, the use of baselines (or snapshots) can be used to mark a version in the source control. This snapshot can then be referred to at any time in the development cycle, potentially as a rollback if some fatal damage is done to the most recent version. This is typically used to mark the release versions or significant milestones in an ongoing development cycle.
Okay, I got that. But why should I care?
Often when building software, whether it be a website or program, there are often multiple people each working on multiple versions of the same project. A key symptom of a lack of version control is the inconsistency across projects.
Bugs and errors can exist on some projects but not others, or behave differently between projects. People can overwrite significant sections of other peoples work, and at the end of it all, someone has to compile everyone’s code into one file and try and get it all to play nice. Using version control, all these problems can be avoided. Whether you are building a website yourself or working in a team, version control is an essential part of any software developer’s toolkit.
Looking to play around with version control? Get out Git here: http://git-scm.com/
Mudbath is a 40+ person digital product agency based in Newcastle, NSW. We research, design and develop products for industry leaders.
Are you a developer who's looking to join Newcastle's fastest-growing software agency? Get in touch.