git diff

Show file differences between working directory, staging area, and commits

Syntax

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

Parameters

ParametersDescriptionExamplesLevel
--staged New ( --cached) Common
--stat Common
--name-only Common
--word-diff Level Common
--color-words Common
-b Common

Examples

git diff

git diff --staged

3

git diff HEAD~3

git diff main..feature

git diff --stat
src/app.js | 12 ++++++------ src/util.js | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-)

git diff -- src/login.js

Tips

Related Commands