A fast, lightweight CLI tool for analyzing Git repository statistics, built with Rust.
- Repository Statistics - View commit counts, line changes, contributor count, and date ranges
- Author Analysis - List all contributors with their individual statistics
- Top Contributors - Display top N authors by commit count
- Author Filtering - Deep dive into any specific contributor's stats
- Flexible Path Support - Analyze any local repository
# Show repository-wide statistics
git-analyzer
# Analyze a specific repository
git-analyzer --path /path/to/repo
# List all authors
git-analyzer --list-authors
# Show top 10 contributors
git-analyzer --list-authors --top 10
# View specific author's statistics (by name or email)
git-analyzer --author "John Doe"
git-analyzer --author "john@example.com"
# Get help
git-analyzer --helpRepository Statistics:
=== Repository Statistics ===
Total authors: 38
Total commits: 370
Total files changed: 904
Total lines added: 25092
Total lines deleted: 11050
First commit: 2025-05-02 16:37:31 UTC
Last commit: 2026-02-02 18:33:46 UTC
Author Listing:
=== Top 10 Authors ===
1. Jane Doe (jane@example.com)
Total commits: 120 (155 files) | +8300 -1500
2. John Doe (john@example.com)
Total commits: 85 (142 files) | +5200 -2100
Individual Author:
=== Jane Doe (jane@example.com) ===
Total commits: 100
Total files changed: 191
Total lines added: 6467
Total lines deleted: 3744
First commit: 2025-05-02 16:37:31 UTC
Last commit: 2026-02-02 18:33:46 UTC
# Clone the repository
git clone https://github.com/yourusername/git-analyzer
cd git-analyzer
# Install globally
cargo install --path .
# Now run from anywhere
git-analyzer --help
git-analyzer -p /path/to/repocargo install git-analyzer# Build and run without installing
cargo run -- --help
cargo run -- -p /path/to/repo
# Build release binary
cargo build --release
./target/release/git-analyzerThe project is structured for extensibility:
src/
├── main.rs # CLI orchestration
├── cli.rs # Command-line argument parsing
├── analyzer/ # Analysis logic
│ ├── mod.rs # Core data structures
│ ├── helpers.rs # Utility functions
│ ├── commits.rs # Repository-wide statistics
│ └── authors.rs # Per-author analysis
└── formatters/ # Output formatting
├── mod.rs
└── terminal.rs # Human-readable terminal output
Key design decisions:
- Trait-based extensibility - Easy to add new analysis types
- Separation of concerns - Analysis logic independent of presentation
- Zero-copy where possible - Efficient handling of large repositories
git-analyzer processes approximately 300 commits per second on typical hardware. Analysis time scales linearly with repository size:
- Small repos (<500 commits): <2 seconds
- Medium repos (1000-3000 commits): 3-10 seconds
- Large repos (5000+ commits): 20-40 seconds
- Remote Repository Support - Analyze repos via HTTPS/SSH without cloning
- File Analysis - Identify most frequently changed files and code churn hotspots
- Time-Based Filtering - Filter commits by date range (e.g., last 30 days, specific sprint)
- Branch Analysis - Compare statistics across branches
- Multiple Output Formats - JSON, CSV, and Markdown export
- Colorized Output - Better visual hierarchy with terminal colors
- Interactive Mode - Browse statistics with arrow keys and filtering
- Collaboration Metrics - Identify knowledge silos and bus factor
- Performance Optimization - Parallel processing and caching for massive repos
- Configuration Files - Save commonly used filters and preferences
This is a learning project built to develop Rust proficiency. Contributions, issues, and feature requests are welcome!
- Rust - Systems programming language
- git2-rs - libgit2 bindings for Git operations
- clap - Command-line argument parsing
- chrono - Date and time handling
- anyhow - Error handling
MIT
Built as a practical exercise in Rust development, focusing on clean architecture and real-world Git analysis use cases.