datarekha

Why version control

Understand how version control lets teams edit the same code in parallel, undo any past mistake, and stop living in a folder of final_v2_FINAL.zip files.

5 min read Beginner Git Lesson 1 of 15

What you'll learn

  • What a commit is: a named snapshot of your whole project with an author and message
  • Why git is distributed — every clone holds the complete history
  • How a team works in parallel on branches and merges changes without overwriting each other

The folder that haunts every solo project

You have been there. A project folder that looks like this:

project/
  final.zip
  final_v2.zip
  final_v2_FINAL.zip
  final_v2_FINAL_actually_final.zip
  backup_before_i_broke_everything.zip

This is manual version control. It is painful, it does not scale past one person, and the moment a teammate emails you their copy of final_v2.zip, you have a merge conflict you have to resolve by reading two files side by side and guessing.

Git was built to solve exactly this problem — for teams of hundreds working on millions of lines of code — but it solves the solo case just as elegantly.

Git as a time machine

The core idea is simple: instead of saving a new zip file when something works, you take a commit (a named save point). A commit is a snapshot of every file in your project at that moment, paired with:

  • a short message you write (“Add login form validation”)
  • your name and email
  • a timestamp
  • a unique ID (a long hex string like a3f8c12)

That snapshot is permanent and tamper-evident. You can jump back to any commit in history and see your project exactly as it was, or ask “who changed this line and why?”

C1InitC2Add navC3Login formB1Feature XC4Fix bugC5Mergemain branchfeature branch
Each circle is a commit — a full snapshot of the project. The feature branch diverges from C3, develops independently, then merges back into main at C5.

Snapshots, not diffs

A detail that matters: git stores a full snapshot of every tracked file at each commit — not just the lines that changed. This makes operations like “restore project to C2” instant and independent of history length. (Internally git deduplicates unchanged files, so storage stays efficient, but the logical model is always a complete picture of the project.)

This is different from older systems like SVN, which stored only incremental diffs. Full snapshots mean you never have to replay a chain of patches just to see what a file looked like two months ago.

Distributed: every clone is a full backup

Git is distributed, meaning when you clone a repository (the folder where git stores all commits and history), you get the entire history locally — not just the latest version. You can commit, browse history, create branches, and work entirely offline.

There is no single server that “owns” the truth. Services like GitHub or GitLab are just well-known places to push a copy so teammates can pull from it. If that server disappeared tomorrow, every developer who ever cloned the repo would still have the full history.

How a team works in parallel

Here is the 30-second mental model of day-to-day team work:

  1. Each engineer clones the shared repository. They each have a full copy.
  2. An engineer creates a branch — a lightweight pointer to a diverging line of commits — so their work-in-progress does not touch anyone else’s code.
  3. They commit to their branch as often as they like. Commits are cheap and local; they cost nothing until pushed.
  4. When the work is ready, they open a pull request: a proposal to merge their branch back into the shared main branch. Teammates review the diff, leave comments, and approve.
  5. The branch merges. Everyone pulls the updated main branch. The cycle repeats.

Nobody emails zip files. Nobody overwrites anyone’s work. And if the merged feature turns out to be broken, the team can revert that merge commit — a single operation — and the codebase is exactly as it was before.

Jargon in one place

TermWhat it means
repositoryThe folder (plus hidden .git directory) that stores all snapshots and history
commitOne snapshot: files + message + author + timestamp + unique ID
branchA named pointer to a line of commits; diverges, develops, merges back
cloneA full local copy of a repository, including all history
distributedEvery clone holds the complete history; no single server is required

The next lesson, Install and configure git, covers getting git running on your machine and introducing yourself to it.

Quick check

0/3
Q1What does git store at each commit?
Q2A colleague says: 'I pushed my commits to GitHub, so even if my laptop dies the work is safe.' What is the one gap in this reasoning?
Q3Your team merges a feature branch on Friday. By Monday the feature has caused a production bug. Without git, recovery means hunting through backup zips and manually undoing changes. With git, the fastest correct action is:

Sign in to track your progress

Completed lessons, your XP, level, and streak save to your account — it's free and takes a few seconds.

Explore further

Glossary terms
Cheat sheets

Related lessons

Skip to content