Git Repository Health Score Calculator
Generate an overall health score for a Git repository from activity and quality signals.
Inputs
Percent of open branches that are stale or long-lived (branch hygiene signal).
Average commit frequency across the repository.
Average time-to-first-review for pull requests.
Current automated test coverage percentage.
Repository Health Score
74.2/100
Health Grade
Good
Branch Hygiene
70/100
Commit Frequency
80/100
PR Review Speed
76/100
Test Coverage
72/100
Step by step
Branch hygiene (25%)
100 - 15 × 2
= 70
Commit frequency (20%)
40 / 50 × 100
= 80
PR review speed (25%)
100 - (20 - 4) / 68 × 100
= 76
Test coverage (30%)
72
= 72
Weighted health score
0.25H + 0.2F + 0.25R + 0.3C
= 74.2
How it works
Repository health blends four weighted signals into a single score: branch hygiene (25%, penalizing stale/long-lived branches), commit frequency (20%, activity level), PR review speed (25%, faster first-review turnaround scores higher), and test coverage (30%, the highest weight since it most directly predicts defect risk). Each sub-score is normalized to 0-100 before weighting.
Formula
health_score = branch_hygiene × 0.25 + commit_frequency × 0.20 + pr_review_speed × 0.25 + test_coverage × 0.30
- branch_hygiene
- clamp(100 - stale_branch_percent × 2, 0, 100)
- commit_frequency
- clamp(commits_per_week / 50 × 100, 0, 100)
- pr_review_speed
- clamp(100 - (avg_review_hours - 4) / 68 × 100, 0, 100)
- test_coverage
- Test coverage percentage (0-100)
Frequently Asked Questions
Why does test coverage get the highest weight?
Of the four signals, test coverage has the most direct empirical link to defect escape rate and safe refactoring — the other three describe workflow health, while coverage describes a safety net for the code itself.
Can a repository have high activity but low health?
Yes — high commit frequency with poor branch hygiene, slow reviews, or low test coverage will pull the composite score down; activity alone doesn't indicate a well-maintained repository.
How is the branch hygiene score calculated?
It penalizes the percentage of stale/long-lived branches at a rate of 2 points per percent, reaching zero once 50% or more of branches are stale — reflecting how quickly hygiene issues compound.
How often should I recompute this score?
Monthly is a reasonable cadence for most teams — frequent enough to catch trend shifts (e.g. coverage regressions, review time creep) without reacting to single-week noise.
You might also need
- Contributor Activity CalculatorCommonly used together
- Release Frequency CalculatorCommonly used together
- Pull Request Review Time CalculatorCommonly used together
- Branch Lifetime CalculatorCommonly used together
- Code Churn CalculatorCommonly used together
- Commit Frequency CalculatorCommonly used together