π HistoryCommonly used
How to view diffs in Git
See exactly what changed in files, commits or branches.
See unstaged changes
git diffShows changes in tracked files that are not yet staged.
See staged changes
git diff --stagedShows changes that are staged and ready to commit.
When to use: Before committing β review exactly what you are about to commit.
Compare two branches
git diff main..feature-branchShows all differences between two branches.
Compare two commits
git diff abc1234..def5678Shows differences between two specific commits.
See only changed file names
git diff --name-only main..featureLists only the file names that changed, without the diff content.