Git Analytics is a powerful, AI-driven command-line tool that transforms your Git repository history into insightful, easy-to-read reports. It intelligently summarizes commits, groups them by theme, and provides high-level executive summaries, helping you understand project progress at a glance.
- 🤖 AI-Powered Summaries: Uses advanced AI models to generate detailed, code-aware summaries for each commit.
- 🧩 Thematic Analysis: Automatically categorizes commits into themes like
Features,Bug Fixes,Documentation, andRefactoring. - 📄 Executive Summaries: Generates a high-level, multi-sentence summary of the entire analysis period, perfect for reports and stakeholder updates.
- 📊 Contributor Analysis: Generate reports summarizing work by author to see who is contributing what.
- 🩺 Code Health Insights: Identify high-churn files and analyze their complexity to flag potential technical debt.
- 🌿 Branch Selection: Analyze any branch in your repository, not just the one you have checked out, using the
--branchoption. - ⚡️ Smart Caching: Caches results to provide near-instantaneous reports on subsequent runs and to minimize API calls.
- 💰 Cost Monitoring: Tracks API token usage and provides an estimated cost for each analysis run, giving you full visibility.
- 📝 Multiple Formats: Generate reports in both Markdown and JSON formats.
This project is managed with uv, a fast and modern Python package manager.
-
Clone the repository:
git clone https://github.com/your-username/gitanalytics.git cd gitanalytics -
Create and activate a virtual environment:
uv venv source .venv/bin/activate # On Windows, use `.venv\Scripts\activate`
-
Install the package:
uv pip install -e .The tool is now available as the
gitanalyticscommand.
The tool requires an API key from an OpenAI-compatible service like OpenRouter.
-
Create a
.envfile in the root of the project by copying the example file:cp .env.example .env
-
Edit the
.envfile and add your API key:# .env OPENROUTER_API_KEY="your-secret-key-goes-here" OPENROUTER_MODEL_NAME="qwen/qwen-2.5-72b-chat"
The main command is analyze. It analyzes the repository in the current directory by default.
gitanalytics analyze [OPTIONS] [REPO_PATH]-
Analyze the current repository:
gitanalytics analyze
-
Analyze a specific repository path:
gitanalytics analyze /path/to/your/repo
-
Analyze a specific branch:
gitanalytics analyze --branch feature/new-login
-
Analyze commits within a date range:
gitanalytics analyze --start-date 2023-01-01 --end-date 2023-01-31
-
Generate a JSON report:
gitanalytics analyze --output json
-
Force a fresh analysis by ignoring the cache:
gitanalytics analyze --no-cache
-
Generate a report summarized by author:
gitanalytics analyze --by-author
-
Include a code health summary in the report:
gitanalytics analyze --code-health
To set up a development environment with all testing dependencies, run:
uv pip install -e ".[dev]"To run the automated test suite:
pytest