This demo showcases the powerful features of git diff for inspecting changes in your repository.
- Basic Diff - Understanding what changed
- Diff Statistics - Quick overview with
--stat - Excluding Files - Filter out noise like
package-lock.json - Whitespace Handling - Show or ignore whitespace differences
- Word Diff - Granular, word-by-word change view
- Staged vs Unstaged - Understanding the three states
- Diff Between Commits - Compare any two points in history
- Custom Formats - Compact, name-only, and more
- Practical Aliases - Boost your productivity
- Advanced Filters - Using
.gitattributesfor smarter diffs
# Exclude files from diff
git diff -- . ':(exclude)package-lock.json'
git diff -- ':!*.lock'
# Whitespace handling
git diff --ignore-all-space
git diff --ws-error-highlight=all
# Word-level changes
git diff --color-words
git diff --word-diff
# Different views
git diff --stat
git diff --name-status
git diff --compact-summary
# Staged vs unstaged
git diff # Working dir vs staging
git diff --staged # Staging vs HEAD
git diff HEAD # Working dir vs HEAD# First time setup
./setup.sh
# Run the interactive demo
./demo.sh
# Reset everything
./reset.sh- Shows how to filter out noise files (lock files, build artifacts)
- Demonstrates whitespace diff options for post-formatting reviews
- Teaches the difference between working directory, staging area, and commits
- Provides practical aliases you can use immediately
- Interactive and educational format