Seeing What Changed: status & diff
Last lesson you met three areas: the working tree, the staging area, and the history (the commits). Now we learn two commands that show you what's happening between those areas without changing anything. git status is your dashboard: 'where am I and what changed?' — which branch you're on, which fil
status is the cashier's receipt: a list of what's in the box (staged), what's still outside it (unstaged), and what's brand new. diff is a side-by-side of the exact words that changed.
- git status
- The repo's dashboard: the active branch, files already staged, changes not yet added, and brand-new untracked files. Read-only — it changes nothing.
- git diff
- Shows the exact difference line by line. With no flag — between the working tree and staging (what you haven't added). With --staged — between staging and the last commit (what's about to be saved).
- Untracked file
- A new file that exists in the folder but Git isn't tracking yet, because it was never added with git add. status lists it under 'Untracked files'.
- Unstaged changes
- Changes in an already-tracked file that haven't been added to staging with git add, so they won't be in the next commit until you add them.