Checking Status and Differences
What you'll learn: How to inspect what's changed in your working directory and what Git sees as modified or staged.
After working on files, you'll often want to ask Git two questions: "What have I changed?" and "What's ready to commit?" Two essential commands answer these questions: git status and git diff.
Using git status
Think of git status as asking Git for a progress report. It shows you:
- Which files you've modified since the last commit
- Which changes are staged (ready to commit with
git add) - Which files are untracked (Git doesn't know about them yet)
Run git status anytime to get your bearings. It's completely safe and doesn't change anything—just reports information.
Using git diff
While git status tells you which files changed, git diff shows you exactly what changed line-by-line. By default, git diff compares your working directory to the staging area, showing unstaged changes.
Analogy: If your working directory is a draft essay and the staging area is the "final draft" folder, git status tells you "essay.txt has edits," while git diff shows you the actual sentences you added or deleted.
You can also use git diff --staged (or git diff --cached) to see what changes are staged and ready to commit—comparing the staging area to your last commit.
Workflow Integration
These commands fit naturally between the three states you learned earlier:
- Edit files in your working directory
- Run
git statusto see what changed - Run
git diffto review specific changes - Use
git addto stage what looks good - Run
git diff --stagedto review what you're about to commit
Key Takeaway: git status shows you which files have changed and their state (modified, staged, untracked), while git diff shows you the exact line-by-line changes in those files—your safety net before committing.