Skip to main content

Analyze git repositories for commit patterns, contributor stats, code churn, and team productivity insights

Project description

๐Ÿ“Š git-insights

PyPI version Python 3.10+ License: MIT

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

Sanjay S โ€” GitHub ยท PyPI


๐Ÿ† 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_insights_cli-1.0.0.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_insights_cli-1.0.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

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

Hashes for git_insights_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 37d1806e6fa626e71d1b0cc90609c64efbb803f584e98873cc397f2012bd3789
MD5 bcdc64273308d812d171fa6dd70ab3f9
BLAKE2b-256 6593f02f86e1d1be8aba7e452d2ae22b1b8184854ee8d164ced3edaa9a1429da

See more details on using hashes here.

File details

Details for the file git_insights_cli-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for git_insights_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47e7e80d1b30615e34a4600e4c0728eb447571550c22c96d51e4aad1c71a157d
MD5 4cacedad9a7688d2d3f779ad6175c9eb
BLAKE2b-256 89427d430a50d23f75bd4bacc16615b80d668e7bb63ec7dc1c0d32283e8e8769

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page