Self-contained git contributor statistics: CLI + interactive HTML dashboard.
Configuration and generated reports live inside this repository — the analyzed repo is never modified.
- Python 3.11+
- Git on
PATH - Full local clone of the target repo (
git fetch --unshallowif shallow)
git-metrics/
generate.py
git-metrics.config.json # optional (copy from example)
git-metrics.config.example.json
reports/ # generated (gitignored)
git-metrics.html
git-metrics.json
git submodule add <url> tools/git-metrics
cd tools/git-metrics
cp git-metrics.config.example.json git-metrics.config.json # optional
npm run generateWhen run from a submodule, the parent repository is analyzed automatically.
Outputs are written under tools/git-metrics/reports/ — no changes to the parent .gitignore.
python generate.py --repo /path/to/target/repo --json| Flag | Description |
|---|---|
--repo |
Target repository (default: git superproject or parent of tool dir) |
--config |
Config path (default: ./git-metrics.config.json) |
--output |
HTML path relative to tool dir (default: reports/git-metrics.html) |
--json |
Also write JSON (default: reports/git-metrics.json) |
--skip-blame |
Fast run without blame data |
GIT_METRICS_TARGET_REPO |
Env override for target repo path |
Edit git-metrics.config.json in this directory:
excluded_path_prefixes— extra prefixes excluded from the code scopepath_scopes— optional prefix scopes (e.g.frontend/,backend/)
Built-in scopes: all, code.
- Clone this repo: normal git remote auth.
- Analysis: reads the target repo’s local
.gitonly (no network unless history is missing).
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: python tools/git-metrics/generate.py --repo "${{ github.workspace }}" --json
working-directory: tools/git-metrics