Skip to content

Your first repo

L2 is the hands-on lesson where the snapshot mental model from L1 meets actual commands. Three load-bearing ideas:

  1. The manual-tracking exercise grounds the WHY in lived experience. Readers feel the cost before they meet the relief.
  2. The three-area model (working directory, staging, repository) is the mental model that makes every later git command coherent.
  3. .gitignore is the discipline that prevents accidentally committing things that should never be tracked.

By the end of L2, the reader will be able to

Section titled “By the end of L2, the reader will be able to”
  • Run a ten-minute manual-tracking exercise that surfaces the real cost of working without version control
  • Initialize a git repository with git init
  • See the state of the working directory, staging area, and repository with git status
  • Stage changes for the next snapshot with git add
  • Take snapshots with git commit and a meaningful message
  • Describe the three-area mental model
  • Write a .gitignore that prevents tracking compiled output, dependencies, editor artifacts, and secrets
  • Recognize the bare-name vs trailing-slash gotcha in .gitignore patterns
  • L1 (Why git exists) for the snapshot mental model
  • Comfort with the command line (knowing how to cd and run commands)
  • A real project folder of your own to experiment with, OR an empty folder for a sandbox

The first half of the lesson is hands-on: readers do the manual-tracking exercise, then meet the commands. The second half (three-area model, .gitignore, audience-specific framings) is conceptual but anchored to what the reader just did.

New developers should do every command. Experienced developers can skim the conceptual sections; the .gitignore symlink gotcha is the one item to read carefully even if everything else is review.

What this lesson deliberately does not cover

Section titled “What this lesson deliberately does not cover”
  • Commit hygiene and message writing (deferred to L3)
  • Recovery operations (deferred to L4)
  • Branching (deferred to L5)
  • Remotes / pushing to GitHub (deferred to L8)
  • Undoing commits (deferred to L4)
  • Detailed git log exploration (deferred to L3)

If you find yourself wanting to know “how do I undo this commit,” the answer is in L4. L2 builds the forward path; L4 covers the backwards path.

20-25 minutes for reading. 10-15 minutes for the manual-tracking exercise at the start (genuinely worth doing, not skipping). 15-20 minutes for the hands-on commit cycle practice. Total time investment for L2 including the practice: ~50-60 minutes.