Course contentsShow
← Software Engineering
Lesson 51 of 1,9332. Version Control with GitFree lesson

Checking Status and Differences

Using 'git status' and 'git diff' to inspect changes in your working directory and staging area.

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:

  1. Edit files in your working directory
  2. Run git status to see what changed
  3. Run git diff to review specific changes
  4. Use git add to stage what looks good
  5. Run git diff --staged to 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.