Skip to main content

Git repository commit statistics collector and visualizer

Project description

📊 oh-my-gitstats

中文 | English

A Python CLI tool for collecting git commit statistics and visualizing them as interactive HTML charts.

Line Chart Heatmap

✨ Features

  • 🔍 Batch Collection - Scan multiple git repositories recursively
  • Incremental Sync - Only fetch new commits since last collection
  • 📈 Line Charts - Track changes over time with metric & granularity switching
  • 🗓️ Calendar Heatmaps - Visualize commit activity with year-based filtering
  • 🎯 Aggregated & Individual Views - See combined or per-repo statistics
  • 📂 VS Code Integration - Open repo folders directly from the HTML report

🚀 Installation

From PyPI (Recommended)

pip install oh-my-gitstats

From Source (Development)

git clone https://github.com/amomorning/oh-my-gitstats.git
cd oh-my-gitstats
pip install -e .

📖 Usage

1️⃣ Collect Commit Data

Scan a directory for git repositories and export to JSON:

gitstats collect /path/to/repos --output ./data

Options:

Option Description
-o, --output Directory to save JSON files (default: ./data)
-q, --quiet Suppress output messages

2️⃣ Incremental Sync

You may collect repos from multiple locations into the same data directory. Re-running collect on every location is slow — sync reads the existing JSON files and only fetches new commits for each repo:

# Collect from multiple locations (one-time)
gitstats collect /path/to/work-projects --output ./data
gitstats collect /path/to/personal-projects --output ./data

# Later, update all at once — only new commits
gitstats sync ./data

Options:

Option Description
-q, --quiet Suppress output messages

3️⃣ Generate Visualization

Create an interactive HTML file from collected data:

gitstats visualize ./data --output ./output/stats.html

Options:

Option Description
-o, --output HTML file path (default: ./output/stats.html)

Granularity and metric can be switched dynamically in the generated HTML — no need to regenerate.

📁 Output

The generated HTML contains:

  1. 📈 Line Chart - Changes over time with metric selector (Lines Changed / Commit Count) and granularity selector (Day/Week/Month). Click legend to toggle projects.

  2. 🗓️ Aggregate Heatmap - Combined activity across all repos with year selector (All Years / specific year).

  3. 📊 Individual Heatmaps - Per-repository calendar views in a responsive grid, each with sync status indicator and an "Open Folder" button to open in VS Code.

alt text

📋 JSON Format

Each repository generates a JSON file:

{
  "repo_name": "my-project",
  "repo_path": "/absolute/path/to/my-project",
  "last_commit_hash": "a1b2c3d4...",
  "sync_status": "synced",
  "commits": [
    {
      "timestamp": "2024-01-15T10:30:00",
      "additions": 45,
      "deletions": 12
    }
  ]
}

The last_commit_hash field stores the HEAD commit hash at collection time. During sync, repositories with a matching hash are skipped instantly — no git operations needed.

The sync_status field indicates the repository's sync state with its remote:

Status Description
synced In sync with remote
✏️ local_changes Local has uncommitted changes, remote is up-to-date
⬇️ remote_ahead Local is clean, but remote has new commits
⚠️ diverged Local has uncommitted changes and remote has new commits
🔒 local_only_clean No remote configured, local is clean
🔧 local_only_dirty No remote configured, local has uncommitted changes

🔧 Requirements

  • Python 3.9+
  • click
  • gitpython
  • pyecharts
  • jinja2

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

oh_my_gitstats-0.1.1.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

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

oh_my_gitstats-0.1.1-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file oh_my_gitstats-0.1.1.tar.gz.

File metadata

  • Download URL: oh_my_gitstats-0.1.1.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for oh_my_gitstats-0.1.1.tar.gz
Algorithm Hash digest
SHA256 424712b60f2cf3550ae1470a1d869cf214ff0c3c3683bf3a224dc3750ac34ea5
MD5 afa647060e3e435b7dfd10f8969f71dc
BLAKE2b-256 941a3702343d14af5b812648c36dc633c209d42207ff4d952972642d8af244cb

See more details on using hashes here.

File details

Details for the file oh_my_gitstats-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: oh_my_gitstats-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for oh_my_gitstats-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f283e8f171b11f77f2aecd7b4b2ed35f03b1b0ce6871ad8ead2bb897f71570c6
MD5 0bae83e46614dd398e406393b209dc2b
BLAKE2b-256 871b15a1840efc0ded9eaba3a281939acc92a87b823622f0133ed2eeac50ca5d

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