git diff

The command that shows the differences between two of Git's states: the working tree, the staging area, or any two commits.

In more detail

git diff alone compares the working tree with the staging area, so it shows changes not yet staged. git diff --staged compares the staging area with the last commit, and git diff HEAD compares the working tree with the last commit. git diff A B compares two commits, and git diff A...B compares B with the merge base, which is what a review shows.

Example

git diff --stat HEAD~1 HEAD

Related terms

Taught in

References