A CLI tool for analyzing and visualizing differences between branches, tags, and commits. Especially useful for managing code synchronization in projects with delayed deployments.
- 🔍 Diff Analysis: Analyze differences between branches, tags, and commits
- 📊 Multiple Visualizations: View results in various formats including Tree, Plain, and JSON
- 🌳 Folder Structure Visualization: Display changes hierarchically according to folder structure
- 💡 Interactive Interface: Step-by-step analysis through an intuitive CLI
- 🎯 Pattern-based Filtering: Selective analysis of specific files or directories
- Clone this repository
git clone
cd diff-tree
- Install dependencies
pnpm install --frozen-lockfile
- Build
pnpm run build
- Link
pnpm link --global
(NPM publication planned)
npm install -g diff-tree
# or
yarn global add diff-tree
# or
pnpm add -g diff-tree
# Run in interactive mode
git diff-tree compare -i
# Specify references directly
git diff-tree compare -f -t
# Filter files by pattern
git diff-tree compare -f main -t develop -p "src/**/*.ts"
# Tree view (default)
git diff-tree compare -f main -t develop --format tree
# Plain text
git diff-tree compare -f main -t develop --format plain
# JSON format
git diff-tree compare -f main -t develop --format json
Option | Description |
---|---|
-i, --interactive |
Run in interactive mode |
-f, --from <ref> |
Starting reference (branch/tag/commit) |
-t, --to <ref> |
Ending reference (branch/tag/commit) |
-p, --pattern <pattern> |
File filtering pattern |
--format <type> |
Output format (tree/plain/json) |
--no-colors |
Disable colored output |
--no-icons |
Disable icons in display |
- Analyzing differences between main project and delayed deployment project:
git diff-tree compare -f main-proj:v1.0.0 -t delayed-proj:v1.0.0
- Check changes in specific directory:
git diff-tree compare -i
# Specify directory pattern in interactive mode: "apps/specific-app/**"
╔══════════════════════╤═════════════╤══════════╗
║ Path │ Type │ Changes ║
╟──────────────────────┼─────────────┼──────────╢
║ 📁 src │ │ +457/-87 ║
║ 📁 components │ │ +315/-81 ║
║ 📄 Button.tsx │ 📝 modified │ +30/-10 ║
║ 📄 Input.tsx │ ✨ added │ +45 ║
╚══════════════════════╧═════════════╧══════════╝
![tree format output example](https://private-user-images.githubusercontent.com/53929065/383957027-a9836f68-3241-41dc-9daa-f31484ee1a6e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyMzEwNjksIm5iZiI6MTczOTIzMDc2OSwicGF0aCI6Ii81MzkyOTA2NS8zODM5NTcwMjctYTk4MzZmNjgtMzI0MS00MWRjLTlkYWEtZjMxNDg0ZWUxYTZlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDIzMzkyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI4YWNhOWIyOGZlMTVlMDEyNDI1MDIyOTgzMDc0YWY3OTUzNzFmMmNmNTEyMTRhOTIyZDI3M2M4ZmQ1ZDJiZWEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.I1uGanc-11fnPb-4XQ4_DRtNPhfEk84FI5cP8cmcbJw)
- Must be run within a Git repository
- Analysis may take time in large repositories
- Filter patterns support regular expressions
graph TB
CLI["CLI (Entry Point)"]
CMD["Commander
(Command Parser)"]
IC["InteractiveCommand"]
DC["DirectCommand"]
CTX["CommandContext"]
STORE["Store
(State Management)"]
EMIT["EventEmitter"]
ROUTE["RouteManager"]
GIT["GitAnalyzer"]
FORM["DiffFormatter"]
CLI --> CMD
CMD --> IC
CMD --> DC
IC --> CTX
DC --> CTX
CTX --> STORE
CTX --> EMIT
CTX --> GIT
CTX --> FORM
IC --> ROUTE
ROUTE --> CTX
subgraph Formatters
FORM --> TREE["TreeFormatter"]
FORM --> PLAIN["PlainFormatter"]
FORM --> JSON["JSONFormatter"]
end
subgraph State Management
STORE --> STATE["AppState
- Analysis
- UI State"]
end
subgraph Git Operations
GIT --> EXEC["Git Command
Executor"]
GIT --> PARSE["Diff Parser"]
GIT --> ANAL["Analysis
Generator"]
end
style CLI fill:#f9f,stroke:#333,stroke-width:4px
style CTX fill:#bbf,stroke:#333,stroke-width:2px
style STORE fill:#bfb,stroke:#333,stroke-width:2px
style GIT fill:#fbb,stroke:#333,stroke-width:2px