HomeRecipesSnippets


git diff

Text

Category: git
Date: Jan. 28, 2025, 11:29 p.m. PST
Tags: diff

See staged, non-commited changes

git diff --cached

See diff between local changes and master

git diff origin/master

See diff between two commits

git diff <SHA1> <SHA2>

See the files changed between two commits

git diff --name-only <SHA1> <SHA2>

See the files changed in a specific commit

git diff-tree --no-commit-id --name-only -r <SHA>

# or

git show --pretty="format:" --name-only <SHA>

See diff before push

git diff --cached origin/master

Compare commits on two branches

git diff <BRANCH1>..<BRANCH2>

See diff between current state and a branch

git diff branch-name

See diff in file between current state and another branch

git diff branch-name path/to/file