Analyze git repositories for commit patterns, contributor stats, code churn, and team productivity insights
Project description
๐ git-insights
Analyze git repositories for commit patterns, contributor stats, code churn, and team productivity insights.
Turn your git history into actionable insights. git-insights analyzes commit patterns, identifies code hotspots, calculates bus factor, scores repository health, and generates beautiful reports โ all from the command line.
โจ Features
| Feature | Description |
|---|---|
| ๐ Commit Analytics | Total commits, lines changed, merge ratios, trends |
| ๐ฅ Contributor Stats | Leaderboard with commits, lines, active days per author |
| ๐ฅ File Hotspots | Identify most churned files (high change + high commits) |
| ๐ Day Distribution | Which days of the week see the most commits |
| ๐ Hour Heatmap | Activity pattern by hour of day |
| ๐ Monthly Trends | Commit frequency over time with bar charts |
| ๐ฅ Health Score | 0-100 repository health grade (A+ to F) |
| ๐ Bus Factor | How many contributors cover 50% of commits |
| ๐ File Types | Changes breakdown by file extension |
| ๐ HTML Reports | Beautiful dark-themed dashboards |
| ๐ JSON Export | Machine-readable output for CI/CD integration |
| โฐ Time Filtering | Analyze specific date ranges with --since/--until |
๐ฆ Installation
pip install git-insights-cli
๐ Quick Start
# Full analysis of current repo
git-insights analyze .
# Generate HTML dashboard
git-insights analyze . --html report.html
# Last 6 months only
git-insights analyze . --since "6 months ago"
# Quick summary
git-insights summary .
# Contributor leaderboard
git-insights contributors .
# File hotspots
git-insights hotspots .
# Activity patterns
git-insights activity .
๐ Commands
analyze โ Full repository analysis
git-insights analyze <PATH> [OPTIONS]
Options:
--since TEXT Start date (e.g., '2024-01-01', '6 months ago')
--until TEXT End date
--html PATH Export HTML dashboard report
-j PATH Export JSON report
Generates comprehensive analysis including:
- Summary stats (commits, lines, age, bus factor)
- Top contributors leaderboard
- Day-of-week distribution with bar charts
- Hour-of-day activity heatmap
- File hotspot table (churn score ranking)
- Monthly commit trend
- File type breakdown
- Health score (A+ to F grade)
contributors โ Contributor leaderboard
git-insights contributors <PATH> [--top N]
hotspots โ Most churned files
git-insights hotspots <PATH> [--top N]
Files with high churn scores (changes ร commits) are potential refactoring candidates.
activity โ Commit activity patterns
git-insights activity <PATH>
Shows day-of-week distribution and hour-of-day heatmap.
summary โ Quick health check
git-insights summary <PATH>
๐ฅ Health Score
The health score (0-100) considers:
| Factor | Bonus |
|---|---|
| 3+ contributors | +10 |
| Last commit < 7 days | +15 |
| Last commit < 30 days | +10 |
| Bus factor โฅ 3 | +10 |
| โฅ 1 commit/day avg | +10 |
| Healthy merge ratio | +5 |
Grades: A+ (90+), A (80+), B (70+), C (60+), D (50+), F (<50)
๐ HTML Dashboard
git-insights analyze . --html report.html
The dark-themed dashboard includes:
- Summary cards โ commits, contributors, lines, bus factor, health grade
- Contributor table โ ranked by commits with add/delete stats
- Day distribution โ bar chart showing weekday vs weekend patterns
- Hour heatmap โ 24-hour activity visualization
- File hotspots โ most churned files with churn scores
- Monthly trend โ commit frequency over time
- File types โ changes by extension
๐ CI/CD Integration
JSON Output
git-insights analyze . -j insights.json
Returns structured JSON with all metrics for dashboards or monitoring.
GitHub Actions
- name: Git Insights
run: |
pip install git-insights-cli
git-insights analyze . -j insights.json --html report.html
๐งช Development
git clone https://github.com/SanjaySundarMurthy/git-insights.git
cd git-insights
pip install -e ".[dev]"
pytest tests/ -v
ruff check .
๐ Requirements
- Python 3.10+
- Git (accessible via command line)
- click >= 8.0
- rich >= 13.0
๐ License
MIT License โ see LICENSE for details.
๐ค Author
๐ Other Tools
| Tool | Description | PyPI |
|---|---|---|
| secret-scanner | Credential & secret leak detector | secret-scanner-cli |
| docker-lens | Dockerfile analyzer & optimizer | docker-lens-cli |
| yaml-doctor | YAML linter for K8s, Compose, GHA | yaml-doctor-cli |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file git_insights_cli-1.0.0.tar.gz.
File metadata
- Download URL: git_insights_cli-1.0.0.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37d1806e6fa626e71d1b0cc90609c64efbb803f584e98873cc397f2012bd3789
|
|
| MD5 |
bcdc64273308d812d171fa6dd70ab3f9
|
|
| BLAKE2b-256 |
6593f02f86e1d1be8aba7e452d2ae22b1b8184854ee8d164ced3edaa9a1429da
|
File details
Details for the file git_insights_cli-1.0.0-py3-none-any.whl.
File metadata
- Download URL: git_insights_cli-1.0.0-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47e7e80d1b30615e34a4600e4c0728eb447571550c22c96d51e4aad1c71a157d
|
|
| MD5 |
4cacedad9a7688d2d3f779ad6175c9eb
|
|
| BLAKE2b-256 |
89427d430a50d23f75bd4bacc16615b80d668e7bb63ec7dc1c0d32283e8e8769
|