[Git] Review staged changes with git diff --cached

Created on November 30, 2026

Use git diff --cached to see what has been staged with git add compared with HEAD.

Show the staged diff

Add a line to file.txt, stage it, and run the following command.

git diff --cached

Example output

diff --git a/file.txt b/file.txt
index a29bdeb..c0d0fb4 100644
--- a/file.txt
+++ b/file.txt
@@ -1 +1,2 @@
 line1
+line2

Compare staged and unstaged changes

With no arguments, git diff compares the working tree with the index. The same file can contain both staged and unstaged changes. For example, stage the addition of line2 and then add line3 without staging it.

git diff --cached   # addition of line2 (staged)
git diff            # addition of line3 (unstaged)

Use the --staged alias

--staged is another name for --cached and produces the same diff.

git diff --staged

Reference

Git