How to View Changes in Git (git diff)
git diff shows the exact line-by-line differences between your working directory, the staging area, and the last commit.
Published September 28, 2026
git diff shows the exact line-by-line differences between your working directory, the staging area, and the last commit.
Key points
- Plain git diff shows unstaged changes — what you've edited but not yet added
- git diff --staged (or --cached) shows staged changes that will be included in the next commit
- git diff branch1 branch2 compares two branches directly
Example
git diff --staged