# What is Version Control?

> The system that tracks changes to files over time, preventing the chaos of 'final_v2_real.txt'.

Subject: Version Control | Lesson 1 of 29 | 3 min read
Interactive lesson: https://codewithanimation.in/git/what-is-version-control
Next: [The Three Trees Architecture](https://codewithanimation.in/git/the-three-trees.md)

## What is Version Control?

Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.

Before version control, developers relied on making copies of entire project folders (e.g., `project_final`, `project_final_real`, `project_final_v3_DO_NOT_TOUCH`). Git solves this by storing snapshots of your project.

## Why it matters

In a professional environment, you are rarely working alone. Version control allows multiple developers to work on the exact same codebase simultaneously without overwriting each other's work.

It also acts as an ultimate safety net. If you introduce a bug, you can instantly time-travel backward to a working state.

## How it works (The Git Model)

Unlike older systems (like SVN) that stored changes as a list of file-based patches, Git thinks of its data more like a series of snapshots of a miniature filesystem.

Every time you commit, Git takes a picture of what all your files look like at that moment and stores a reference to that snapshot. If files haven't changed, Git doesn't store the file again, just a link to the previous identical file.

## Common mistake: Confusing Git with GitHub

The #1 beginner mistake is thinking Git and GitHub are the same thing. **Git** is the local software running on your computer that tracks versions. **GitHub** is just a website owned by Microsoft that hosts Git repositories in the cloud.

## Tip: The 'Time Machine' mental model

Don't think of Git as a backup tool (like Dropbox or Google Drive). Think of it as a time machine. You can jump back to any point in history, branch off into an alternate reality, and merge those realities together.

## Try it: Follow a version timeline

Compare numbered file copies with the snapshots recorded in a Git history.

The animation is on the lesson page and is not part of this text version: https://codewithanimation.in/git/what-is-version-control

## Check yourself

### Question 1

What is the primary difference between Git and GitHub?

- A. They are the exact same thing.
- B. Git is for local version control, GitHub is a cloud hosting service for Git repositories.
- C. Git is for Windows, GitHub is for Mac and Linux.
- D. Git requires an internet connection, GitHub works completely offline.

Correct answer: B

Git is the underlying version control software you install on your machine. GitHub is a third-party company that hosts Git repositories online to enable collaboration.

- Why not A: This is a very common misconception. They are fundamentally different.
- Why not C: Git is a cross-platform command-line tool available on all OSes.
- Why not D: It's the exact opposite! Git works 100% offline. GitHub requires the internet.

### Question 2

How does Git fundamentally store its data compared to older Version Control Systems (VCS)?

- A. As a list of file-based changes (deltas) over time.
- B. By zipping the entire project folder every time you save.
- C. As a stream of snapshots of a miniature filesystem.
- D. By only tracking text files and ignoring images.

Correct answer: C

Git takes a 'snapshot' of what all your files look like at a given moment. If a file hasn't changed, Git just links to the previous identical file to save space.

- Why not A: This is how older systems like Subversion (SVN) worked.
- Why not B: This would take up way too much storage space.
- Why not D: Git can track binary files (like images) as well as text files.

### Question 3

Which of the following is NOT a benefit of using Version Control?

- A. Automatically fixing syntax errors in your code.
- B. Allowing multiple developers to work on the same codebase simultaneously.
- C. Providing a complete history of every change made to a project.
- D. Allowing you to revert your project back to a previous, working state.

Correct answer: A

Git tracks changes to files over time, but it does not analyze or understand the code itself. It won't catch or fix syntax errors.

- Why not B: This is one of the main benefits of Version Control.
- Why not C: This is the core function of a Version Control System.
- Why not D: This is a primary benefit and safety net of using Git.

## Remember this

- Git is the local software; GitHub is the cloud host.
- Git works completely offline.
- Git stores data as snapshots, not a list of changes.
