Manuals / Git & GitHub / Chapter 2

A · Daily · beginner · Day 1–2 · Chapter 2 of 12

Daily loop: status, diff, add, commit

Working tree → staging (index) → local history → remote. status and diff before every commit.

Path progress
11%

Step 1 of 3

Three trees

Working directory (edited files), staging area (git add), repository (git commit). status shows all three.

Three treesDrag stickies · tap for tips
Study mapDrag stickies · tap for tipsKeep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Assert the UIdrag · tap →Retry wiselydrag · tap →Seed datadrag · tap →Close the loopdrag · tap →Keep it shortdrag · tap →Name the waitdrag · tap →Scope locatorsdrag · tap →Trace when stuckdrag · tap →One browser firstdrag · tap →Isolate statedrag · tap →Pathwise hackdrag · tap →Three treesdrag · tap →Try thisdrag · tap →Follow the dashed drag · tap →

Example

git status
git diff
git add README.md
git diff --staged
git commit -m "docs: explain three trees"
git log --oneline -5

Do this now

Edit README. status. diff. add. diff --staged. commit. log --oneline.

Was this step clear?
Chapter learning outcomes
  • Working tree vs staging vs history
  • git status / diff
  • git add / commit
  • Commit messages

Clear these before you leave

Side quest

Commit hygiene

Fix typo in separate commit from feature work.