Ad space (banner)
🌿Git Lessons
Lesson 27 / 59

Viewing the Staged Diff with git diff --staged

This lesson covers checking the diff of staged content with git diff --staged. It's for anyone searching "git diff --staged usage."

git diff --staged shows the content you've already added to staging with git add. A regular git diff shows unstaged changes, while this shows what's already staged.

In Try It, run git diff --staged. Only the changes currently in staging appear, color-coded red (removed) and green (added).

A common early mistake is confusing this with a regular git diff — if you're not aware of which side (before or after staging) you're looking at, you risk committing something you didn't intend to. In real teams, this command is valuable for a final check, right before committing, of "exactly what's actually going to be recorded."

Git
Try it (type this into the pseudo terminal)
git diff --staged

🧑‍💻 You can type this command into the Git pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)