Skip to content

akotsampaseris/git-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-analyzer

A fast, lightweight CLI tool for analyzing Git repository statistics, built with Rust.

Features

Current Features (v0.1.0)

  • 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

Usage

# 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 --help

Example Output

Repository 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

Installation

From Source

# 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/repo

From Crates.io (coming soon)

cargo install git-analyzer

Development

# Build and run without installing
cargo run -- --help
cargo run -- -p /path/to/repo

# Build release binary
cargo build --release
./target/release/git-analyzer

Architecture

The 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

Performance

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

Future Features

Planned Enhancements

  • 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

Contributing

This is a learning project built to develop Rust proficiency. Contributions, issues, and feature requests are welcome!

Technology Stack

  • Rust - Systems programming language
  • git2-rs - libgit2 bindings for Git operations
  • clap - Command-line argument parsing
  • chrono - Date and time handling
  • anyhow - Error handling

License

MIT

Acknowledgments

Built as a practical exercise in Rust development, focusing on clean architecture and real-world Git analysis use cases.

About

A fast, lightweight CLI tool for analyzing Git repository statistics and contributor metrics, built with Rust.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages