Command Reference

git diff Tutorial

Explains how git diff compares working tree, index, and commit states, and which forms are most useful day to day.

The short version

git diff compares two states, whether that means the working tree, the staging area, or commits in history.

Most common forms

git diff
git diff --staged
git diff HEAD
git diff main...feature/login