Version Control

Source code is difficult to write and constantly subject to change. Sometimes a change turns out to be wrong and you need to revert it and try something else; when you work in a team, this becomes a much bigger problem. To track software changes, professional developers use a Version Control System (VCS).

Use-Cases

A version control system adds process complexity — so why bother? A few concrete use-cases answer that:

  1. Team collaboration
  2. Improved on-boarding
  3. Test automation
  4. Release automation
  5. Root cause analysis

Many version control systems have been tried over the years. The most desired features are network efficiency, compression, storage efficiency, and decentralization — and some systems deliver these better than others:

  • SVN (Subversion) — centralized, but efficient;
  • Mercurial — easy to use, semi-centralized;
  • Git — efficient and fully decentralized.

Basic Concepts

A handful of concepts show up in every version control system, whichever one you use:

  • Repository — the central place where source code is stored.
  • Cloning — copying the repository to your local machine.
  • Branching — working in a separate, isolated copy of the code.
  • Synchronization — merging code and pulling in updates.

Cloud-Based SCM

A repository is traditionally local to a company, stored on a company server. Large teams and open source projects instead lean on cloud-hosted repositories — a handful of platforms dominate:

  • GitHub
  • BitBucket
  • SourceForge
  • GitLab

These platforms also provide project management tooling on top of the repository itself, so any developer can start a project quickly and invite others to collaborate. Working effectively in a team of developers is one of the most important skills in software engineering — and it's a skill you build through practice.

This page covers version control as a concept. For the practical, day-to-day Git workflow — architecture, commands, branching strategy, forking, and pull requests — see Git Workflow in the Open Source Development roadmap.