3.1. Distributed Version Control Systems

3.1.1. What is Version Control?

No serious development should be done without version control. In fact, version control is so important, many developers would argue that almost no development should be done without version control. Even all my notes for class I keep in version control.

Version control allows developers to:

  • Get any prior version of a project.
    • Released version 1.5 of your website, and now it is crashing? Quick! Go back to version 1.4.
    • Did the ‘new guy’ mess up the project? Revert back!
  • Know exactly what changed in the code, when, and by who. See who is actually doing the work. If a mistake gets added in, see when it was added and by whom.
  • Easily share code between developers.
  • Easily work independently of other developers.
  • Recover an accidentally deleted or overwritten file.
  • Go back and create a bug-fix release on prior versions of a program.
  • Work on multiple computers and keep files in sync.

Version control saves untold time and headaches. It used to be that version control had enough of a learning curve that some developers refused to use it. Thankfully today’s version control tools are so easy to use there’s no excuse not to.

There are two main types of version control. The original version control systems were “centralized.” Subversion (SVN) is a very popular piece of software that supports this type of version control. The other type is a “Distributed Version Control Systems” (DVCS). There are two popular versions of DVCS in use today, Git and Mercurial. Mercurial is sometimes also known as Hg. Get it? Hg is the symbol for Mercury. Either Git or Hg works fine, but for this tutorial we will standardize on Git.