Code of the Day
BeginnerGit & Version Control

Seeing what changed

status, diff, and log — always know the state of your repo before you act.

FundamentalsBeginner8 min read
Recommended first
By the end of this lesson you will be able to:
  • Read git status to see what's modified, staged, and untracked
  • Use git diff to inspect exact changes before committing
  • Read git log to navigate history

Git is far less mysterious once you can see what it's doing. Three read-only commands tell you everything about the state of your repository — and you should reach for them constantly, especially before committing or running anything destructive.

git status — the most important command

git status answers "where am I, and what's changed?" It lists which files are modified, which are staged for the next , and which are untracked (new files git isn't watching yet):

git status

Run it often. Before every commit, git status tells you exactly what you're about to record — no surprises.

git diff — the exact changes

status tells you which files changed; git diff shows you what changed, line by line:

git diff            # changes in your working tree, not yet staged
git diff --staged   # changes you've staged, about to be committed

Lines starting with + are additions, - are removals. Reading the diff before you commit is the single best habit for catching mistakes — a stray debug line, a wrong value, a file you didn't mean to touch.

Do it yourself: edit your README, then run git status (see it listed as modified), git diff (see the exact lines), git add, and git diff --staged (see the same change now staged). You've watched a change move through the stages with your own eyes.

git log — the history

git log walks back through your commits, newest first:

git log                  # full history with messages
git log --oneline        # one compact line per commit
git log --oneline -5     # just the last five

Each commit has a unique hash (like a1b2c3d); you'll use those short hashes to refer to specific commits later (when undoing, comparing, or bisecting).

Reviewing AI-generated changes

This is also exactly how you review a change an agent made: git status to see what it touched, git diff to read every line it wrote, before you commit. Never commit a diff you haven't read — whoever wrote it.

Where to go next

You can inspect any state of your repo. Next: branching and switching — working on changes in isolation without disturbing your main line.

Finished reading? Mark it complete to track your progress.

On this page