All commands

git status

Compare the working tree, the index, and the last commit.

What 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.

~/project · git status
On branch main
Your branch is ahead of 'origin/main' by 2 commits.
Changes to be committed:
modified: src/button.tsx ✚
Changes not staged for commit:
modified: src/theme.css ✏
Untracked files:
notes.md

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.

1 / 3

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 status
~/project · git status
On branch main
Your branch is ahead of 'origin/main' by 2 commits.
Changes to be committed:
modified: src/button.tsx ✚
Changes not staged for commit:
modified: src/theme.css ✏
Untracked files:
notes.md

Git reports where every file stands

Under the hood

1

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.

2

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
3

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.

4

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 status
AliasWhy people use it
g st

The single most-used alias in the wild.

g sts

Compact one-line-per-file form.

g s

Oh-my-zsh default; shows branch too.

Command anatomy

git status [--short]
--short

Compact machine-friendly output: M, A, D, ??…

--branch

Show branch and ahead/behind info alongside the status (often -sb).

--ignored

Also 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.

Go deeper with