git status
Compare the working tree, the index, and the last commit.
git statusWhat it does
git status is a read-only report. It walks three places — your working files, the index (what you've staged), and HEAD (the last commit) — and tells you how they differ. Untracked files are shown because Git sees them as new and untracked.
A real git status, colour-coded by the three states
Watch it — press play
A narrated, step-by-step walkthrough that shows how to do it — not just theory. It adapts to the learner mode you picked in the top bar.
Step 1
Look
You want to know what changed. Just run git status — it compares three snapshots: your files, the index, and the last commit.
git statusGit reports where every file stands
Under the hood
Three stateful places, three questions
Every file in the repo can be described by comparing three snapshots: HEAD (last commit), the index (staging area), and the working tree (what's on disk). Status just diffs them pairwise.
It never reads file contents — only a checksum
Status compares the blob hash recorded in the index with a fast hash of the file on disk. If they match, the file is considered unchanged; status does not re-read full contents and does not diff.
.git/index → 0b2a… ls-files -s worktree → hash → compare
Branches ahead/behind
When upstream tracking is set, status adds one more comparison: your branch ref vs the remote-tracking branch (refs/remotes/origin/main). That gives the 'Your branch is ahead by 2' line without touching the network.
Untracked ≠ modified
Files Git has never seen (not in the index) are 'untracked'. They have no hash to compare, so they're listed separately and are invisible to git diff.
Aliases the pros type
Memorize the git status concept, then let one of these shortcuts make it instant. Aliases are real git config keys — add one with:
git config --global alias.st # → git statusg stgit statusThe single most-used alias in the wild.
g stsgit status --shortCompact one-line-per-file form.
g sgit status --short --branchOh-my-zsh default; shows branch too.
Command anatomy
--shortCompact machine-friendly output: M, A, D, ??…
--branchShow branch and ahead/behind info alongside the status (often -sb).
--ignoredAlso list files ignored via .gitignore.
When to reach for it
First command in a session — you always want to know what state your repo is in.
Before committing, to see exactly what will be included.
After pulling, to catch conflicts or surprises quickly.
Pro tip
`git status --short` prints exactly two columns: the index state (1st char) and the worktree state (2nd char). 'M ' staged vs ' M' unstaged — order matters.