What version control is

Git · Essentials · 6 min

Every software team uses it; without it, collaboration and recovering from mistakes are guesswork.

A version control system (VCS) keeps the full history of a project: who changed what, when, and why. Instead of report-final-v3-REALLY-final.docx, you have one set of files plus a timeline of snapshots you can return to at any moment.

Older systems such as Subversion are centralized: one server holds the history and everyone checks files out from it. Git is distributed: every clone is a complete copy of the repository, history included. That means you can commit, browse history, branch and diff while offline, and any clone can serve as a backup.

Git thinks in snapshots, not lists of edits. Each commit records what the whole project looked like at that moment, plus a message and a pointer to the commit(s) before it. Unchanged files are stored once and shared between snapshots, so this is cheap.

What you get from it in daily work:

  • A safety net: any committed state can be recovered, so experimenting is cheap.
  • Collaboration: several people change the same project in parallel and Git combines their work.
  • Answers to "why is this line here?" through commit messages and blame.
  • Branches: isolated lines of work that can be merged back later.

Git is the de facto standard, and hosting services such as GitHub, GitLab and Bitbucket add code review, CI and issue tracking on top of it. Git itself is just the command-line tool and file format; it works fine with no server at all.

Remember

  • Git stores snapshots of the whole project, linked into a history
  • Distributed: every clone has the full history and works offline
  • Git is the tool; GitHub/GitLab are hosting services built around it

Watch out for

  • Thinking Git and GitHub are the same thing — Git runs locally without any account or server.

Check yourself

  1. What does 'distributed' mean for Git?
  2. How does Git primarily think about a commit?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: git-scm.com/book/en/v2/Getting-Started-About-Version-Control

Builds on

Nothing: this is a foundation.

Unlocks