git-diff
Show differences between commits and files
TLDR
Show unstaged changes
$ git diff
Show staged changescopy
$ git diff --staged
Diff between branchescopy
$ git diff [branch1]..[branch2]
Diff specific filecopy
$ git diff [file.txt]
Show word-level diffcopy
$ git diff --word-diff
Show stat summarycopy
$ git diff --stat
Diff between commitscopy
$ git diff [commit1] [commit2]
copy
SYNOPSIS
git diff [options] [commit] [--] [path...]
DESCRIPTION
git diff shows differences between commits, branches, working directory, and staging area. It is essential for reviewing changes before committing and understanding what changed between versions.By default, it shows unstaged changes (working directory vs index). With --staged, it shows what will be committed. When given two commits or branches, it shows all changes between them.
PARAMETERS
--staged, --cached
Compare staged changes to last commit.--stat
Show diffstat summary.--word-diff
Show word-level changes.--color-words
Colored word diff.--name-only
Show only changed file names.--name-status
Show names and change status.-U n, --unified n
Lines of context.--no-index
Compare files outside repository.--diff-filter filter
Filter by change type (A, D, M, R).-b, --ignore-space-change
Ignore whitespace changes.-w, --ignore-all-space
Ignore all whitespace.