CHAPTER 01

The problem before the tool

Before you learn any commands, feel why they had to be invented.

The setup

You're writing a report. It's taken three weeks. Forty pages. It's due tomorrow.

Late at night, you decide to rewrite the introduction. You delete six paragraphs and write new ones. You save the file. You close your laptop.

The next morning, you reread what you wrote. The new introduction is worse. Much worse. You want the old one back.

THE PROBLEM
You saved over the only copy. The old introduction is gone. There is no undo. The file on disk is the file you have.

Stop here. Before reading further — what would you do next time to avoid this?

The instinct

Most people arrive at the same answer: make a copy of the file before changing it.

YOUR FOLDER — ATTEMPT #1
📄 report.docx
📄 report-backup.docx
📄 report-v2.docx
📄 report-v2-final.docx
📄 report-v2-FINAL-FINAL.docx
📄 report-v2-FINAL-FINAL-fixed.docx
...which one is the real one?

You've seen this. Everyone has. The copy strategy almost works, but it breaks in three specific ways.

Where it breaks

You can't tell what changed

You have "report-v2.docx" and "report-v3.docx." What's different between them? Was it the introduction you rewrote, or the data table you fixed? The filename doesn't tell you. You'd have to open both files and compare them, paragraph by paragraph.

Add a second person and it falls apart

Your classmate is working on Chapter 3 while you fix Chapter 1. You both started from "report-v2.docx." Now you have "report-v3-dhruv.docx" and "report-v3-ankit.docx." How do you combine them into one file without losing either person's work? Copy-paste? What if you both changed the same paragraph?

You don't know when or why

"report-backup.docx" — when did you make this? Before the introduction rewrite, or after? Was it the version you showed to your professor, or the draft before that? There's no record.

What you actually need

Think about what a real solution would look like. You need a system that:

THINK ABOUT IT
Given the three problems above, which of these features is the most essential?
The core need is a history of changes — not just copies of the whole file, but a record that says "on Tuesday at 3pm, I changed the introduction because the original was too long." Cloud backup and collaboration tools are useful, but they're built on top of this foundation.

Let's make the wishlist concrete. You need something that can:

PROBLEM WHAT YOU NEED
Lost the old version after saving Save snapshots of your work at any point — and go back to any of them
Can't tell what changed between copies Each snapshot has a message explaining what changed and why
Two people, same file, conflicting changes A way to merge two people's work — and flag conflicts when they touch the same lines
No record of when or why Each snapshot records who made it, when, and a description of why

The name for all of this

What you just described — a system that records snapshots of your work, tracks what changed between them, knows who changed what and when, and can merge multiple people's contributions — already exists.

It's called version control.

And the most widely used version control tool in the world — the one used by nearly every software team, open-source project, and tech company on Earth — is called Git.

KEY IDEA
Git wasn't invented because someone thought "let's make a cool developer tool." It was invented because the file-copying approach doesn't scale — not past a few changes, not past a single person, not past a single day. Git solves the exact problems you just identified.

What Git is not

Before we go further, let's clear three common confusions:

Git is not GitHub

Git is a tool that runs on your computer. GitHub is a website that stores Git repositories online and adds collaboration features (pull requests, issues, teams). You can use Git without GitHub. You can't use GitHub without Git.

Git is not just for code

Git works on any text file — code, documentation, configuration, even this guide you're reading. It's less useful for binary files (images, PDFs, .docx) because it can't show you the difference between two versions line-by-line.

Git is not a backup service

Git stores history, but it's not designed to back up your entire computer. It tracks deliberate snapshots of a specific project. Each snapshot is one you chose to make, with a message explaining why.

The mental model

Here's the simplest way to picture what Git does:

YOUR PROJECT'S TIMELINE
Mon 9am v1
Mon 3pm v2
Tue 11am v3
YOU ARE HERE v4

Each circle is a snapshot (Git calls it a "commit"). Each has a message, an author, and a timestamp. You can jump back to any of them.

In the next chapter, we'll look at exactly how Git stores these snapshots — and why it's smarter than just copying files.

Check your understanding

CHAPTER 1 QUIZ
Your teammate edits the same file as you, at the same time. With the copy-paste approach, what is the fundamental problem?
The core issue is merging. When two people change the same file independently, combining their work requires knowing exactly what each person changed — which the copy-paste approach doesn't track.
CHAPTER 1 QUIZ
What is the relationship between Git and GitHub?
Git was created by Linus Torvalds in 2005 as a free, open-source tool. GitHub was founded in 2008 as a web platform built on top of Git. Git existed for years before GitHub, and alternatives like GitLab and Bitbucket also exist.