SyntaxStudy
Sign Up
Home Git Reference git diff

git diff

command

Shows changes between working directory, staging area, and commits.

Syntax

git diff [options] [paths]

Example

bash
git diff                 # unstaged changes
git diff --staged        # staged changes (before commit)
git diff HEAD            # all changes since last commit
git diff main..feature  # between branches
git diff abc123..def456  # between commits