Home/Learn/Git/What is Git & Why Version Control?

What is Git & Why Version Control?

Beginner
Beginner

Git is a distributed version control system that tracks every change to your codebase, lets multiple developers collaborate safely, and makes any version of your project recoverable.

Overview

Before version control, teams shared code by emailing zip files or using shared network drives — overwriting each other's work was routine. Version control systems solve this by recording every change as a snapshot, who made it, and why. Git, created by Linus Torvalds in 2005 for the Linux kernel, became the industry standard because it is distributed: every developer has a full copy of the repository, including its entire history. There is no central server that becomes a single point of failure. You can commit, branch, and merge entirely offline. Git's design around content-addressable snapshots (not diffs) makes branching nearly free and merging predictable.

The Problem Git Solves

Imagine 3 developers working on the same file. Without version control, the last person to save wins and everyone else's work is lost. Even with file locking, only one person can work at a time. Git lets everyone work in parallel on isolated branches, then merge the changes together — automatically resolving most conflicts.

The chaos Git replaces
// Without Git ❌
project-v1.zip
project-v1-final.zip
project-v1-final-FINAL.zip
project-v1-ACTUALLY-FINAL-johns-changes.zip

// With Git ✅
git log --oneline
a3f8c12  Add payment gateway integration
9d2e441  Fix null pointer in checkout flow
3b7f920  Implement shopping cart
1a2b3c4  Initial commit

Centralised vs Distributed VCS

Older systems like SVN use a central server — if it goes down, nobody can commit. Git is distributed: your local clone IS the full repository. You push to a remote (GitHub, GitLab) to share, but you don't need the remote to work.

VCS architecture comparison
// Centralised VCS (SVN) — single point of failure
Developer A ──â–º Central Server â—„── Developer B
                 (history lives only here)

// Distributed VCS (Git) — every clone is complete
Developer A         Developer B         Developer C
  [full repo]   â—„──â–º  [full repo]  â—„──â–º  [full repo]
       â–²                                       â–²
       â””──────â–º GitHub Remote â—„───────────────┘
                (shared hub, not the authority)

The Three Areas of Git

Understanding the three areas is the key to understanding all Git commands. The working directory is where you edit files. The staging area (index) is where you build your next commit. The repository is the committed history.

The three Git areas
//  Working Directory  →  Staging Area  →  Repository
//  (files you edit)       (git add)        (git commit)
//
//  ┌─────────────┐    git add    ┌──────────┐   git commit  ┌────────────┐
//  │   Modified  │  ──────────â–º │  Staged  │ ────────────â–º │  Committed │
//  │   files     │              │  changes │               │  history   │
//  â””─────────────┘              â””──────────┘               â””────────────┘
//        ▲                                                        │
//        â””────────────────── git checkout ─────────────────────── ┘

// Check which area each file is in:
git status

// Move to staging:
git add filename.js        // one file
git add src/               // whole directory
git add -p                 // interactively pick hunks

// Move staged → committed:
git commit -m "Add login validation"

Key Points to Remember

  • 1Git records snapshots of your entire project, not diffs — this makes switching branches instant
  • 2Every developer has a full local copy — work offline, commit, branch, and merge without a server
  • 3The three areas: Working Directory (edit) → Staging Area (git add) → Repository (git commit)
  • 4git status shows you exactly where every changed file lives across the three areas
  • 5Git was created in 2005 by Linus Torvalds to manage the Linux kernel — built for massive scale

Interview Questions

Sign in to ask Aria
1

What is the difference between Git and GitHub?

Easy
2

Explain the three areas of Git — working directory, staging area, and repository.

Easy
3

Why is Git called a distributed VCS? What are the advantages over centralised systems?

Medium

Ask Aria about What is Git & Why Version Control?

Your personal AI tutor — ask anything about this concept

Revision Status

Personal Notes

Sign in to save personal notes for this topic.

Discussion

Sign in to join the discussion.

Loading discussion…