CH.01 · 6 MIN · PART 1

Why Git?
Because of
final_v3.

Every project turns into a pile of copies. Git is the tool that replaces the pile with one clean timeline you can scroll, undo and share. This chapter shows how, with pictures you can poke.

You'll leave knowing
RepositoryCommitBranchRemote
report.docx report_final.docx report_final2.docx report_FINAL_v3.docx report_REAL_final.docx report_use_this_one.docx report_final(1).docx ??? which one ???
> git log --oneline
9c2e07 fix typos
5b1a44 add intro
a1f3c9 first draft
> one file. all versions.
What you get
Snapshots
History
Branches
Undo
Teamwork
Backup

The problem, in 3 pictures

essay.docxessay_final.docxessay_final_v3_REAL.docxessay_use_THIS_one.docx?!

1 · Without Git: copy chaos

You save a new file name every time you are scared to lose work. After a week nobody knows which one is current, or what changed between them.

No historyNo undoNo idea
a1f3c9first draft5b1a44add intro9c2e07fix typosNOWgo back here

2 · With Git: one timeline

One file name. Each save point (a commit) is a labelled snapshot on a line. Jump back to any of them, compare two, or undo a mistake.

SnapshotsMessagesTime travel
YOUFRIENDGITHUBfull copyfull copyshared copy

3 · Git + GitHub: everyone has a copy

Git keeps the whole history on every laptop. GitHub is a website that holds a shared copy, so people can swap work without emailing files.

DistributedBackupCollaboration

Try it: save & time-travel

LIVE DEMO

1 · edit the file   2 · save a snapshot   3 · drag the slider or click an old snapshot

notes.txt● unsaved

Your timeline

newest on top · click one to view it

Save a snapshot to start your history.
In real Git: git add then git commit -m "message" does this.

The short story

Quiz time

Before 2005 · A tool goes away

The Linux kernel team used a proprietary tool, BitKeeper. When free access ended, they needed another way to track code from thousands of people.

April 2005 · Linus builds Git10 DAYS

Linus Torvalds made the first commit on April 7, 2005, and wrote the first version in about ten days. Goals: fast, simple, and fully distributed.

April 2008 · GitHub goes live

GitHub opened its doors, giving Git a friendly home on the web. That's the "Hub" half. You meet it properly in Chapter 2, and use it in Part 3.

Source: Pro Git book
UP NEXT

Chapter 02: Git vs GitHub

Two tools, one workflow. Where each one lives and what each does.

Next chapter

3-line recap

  1. Git saves labelled snapshots (commits) of your project, so no more final_v3_REAL.
  2. Every snapshot is a safe point you can return to, compare, or undo.
  3. GitHub stores a shared copy online so people can work together.

Quick check

1 / 3

Pick an answer.