Git Cheatsheet - Quick Git Command Reference

Quick reference for common Git commands. Search, copy, and use Git commands instantly.

Share
Back to Git Cheatsheet

git diff

Show changes between commits

Syntax

git diff [options] [<commit>] [--] [<path>...]

Common Options

OptionDescription
--cached, --stagedShow staged vs last commit diff
HEADShow all changes including staged
<commit> <commit>Compare two commits
--statShow file-level statistics
--name-onlyShow file names only
--word-diffWord-level diff
--color-wordsColorized word diff

Examples

git diff

View unstaged working tree changes

git diff --cached

View staged changes

git diff HEAD

View all uncommitted changes

git diff main..feature

Compare two branches

git diff --stat

View change statistics

Related Commands

Related Tools

More Code & Dev Tools