trueloc
A CLI tool to count your true lines of code from GitHub
Analyze your coding activity via GitHub pull requests and direct commits:
- Total lines written since any date
- Per-PR and per-commit breakdown showing when each contribution was made
- File type analysis revealing which languages you've worked with most
Why trueloc?
GitHub's contribution stats can be misleading. When you squash-merge a PR, GitHub only shows the final diff—not all the work you actually did.
Example: A PR where you add 1000 lines, delete them, then add 1 line shows just +1 on GitHub. But trueloc counts what you actually wrote: +1001 / -1000.
trueloc gives you the true picture of your coding activity.
Quick Start
# Install (recommended)
uv tool install trueloc
# Or run directly without installing
uvx trueloc count USERNAME --since 1m
# Authenticate with GitHub (if not already)
gh auth login
# Count your lines since a date
trueloc count USERNAME --since 2024-01-01
Example Output
Running trueloc count basnijholt -s 1y produces:
Lines of Code by Month
┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Month ┃ Additions ┃ Deletions ┃ Total ┃ Net ┃ ┃
┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
│ 2025-01 │ +9,886 │ -933 │ 10,819 │ +8,953 │ │
│ 2025-02 │ +16,893 │ -5,776 │ 22,669 │ +11,117 │ │
│ 2025-03 │ +74,655 │ -30,098 │ 104,753 │ +44,557 │ ███ │
│ 2025-04 │ +27,380 │ -7,696 │ 35,076 │ +19,684 │ █ │
│ 2025-05 │ +14,356 │ -3,983 │ 18,339 │ +10,373 │ │
│ 2025-06 │ +42,728 │ -17,681 │ 60,409 │ +25,047 │ █ │
│ 2025-07 │ +163,684 │ -93,242 │ 256,926 │ +70,442 │ ████████ │
│ 2025-08 │ +49,019 │ -15,727 │ 64,746 │ +33,292 │ ██ │
│ 2025-09 │ +13,597 │ -834 │ 14,431 │ +12,763 │ │
│ 2025-10 │ +180,196 │ -74,821 │ 255,017 │ +105,375 │ ████████ │
│ 2025-11 │ +711,228 │ -216,940 │ 928,168 │ +494,288 │ ████████████████████… │
│ 2025-12 │ +253,971 │ -72,893 │ 326,864 │ +181,078 │ ██████████ │
│ 2026-01 │ +211,498 │ -102,750 │ 314,248 │ +108,748 │ ██████████ │
└─────────┴───────────┴───────────┴─────────┴──────────┴───────────────────────┘
Lines by Month - Top 3 Languages
┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━┳━━━━━━━━┳━━━━━━━━━┓
┃ Month ┃ .py ┃ .js ┃ .ipynb ┃ Total ┃
┡━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━╇━━━━━━━━╇━━━━━━━━━┩
│ 2025-01 │ 286 │ 8,407 │ - │ 8,693 │
│ 2025-02 │ 9,560 │ 8,194 │ - │ 17,754 │
│ 2025-03 │ 69,628 │ 18,925 │ - │ 88,553 │
│ 2025-04 │ 6,840 │ 6,520 │ - │ 13,360 │
│ 2025-05 │ 3,889 │ 8,874 │ - │ 12,763 │
│ 2025-06 │ 30,345 │ 9,076 │ 142 │ 39,563 │
│ 2025-07 │ 102,308 │ 59,393 │ 2,039 │ 163,740 │
│ 2025-08 │ 47,366 │ 2,140 │ - │ 49,506 │
│ 2025-09 │ 2,581 │ 4,569 │ - │ 7,150 │
│ 2025-10 │ 148,358 │ 6,873 │ - │ 155,231 │
│ 2025-11 │ 212,580 │ 7,348 │ 54,103 │ 274,031 │
│ 2025-12 │ 150,940 │ 18,657 │ 11,973 │ 181,570 │
│ 2026-01 │ 87,307 │ 162 │ 6,724 │ 94,193 │
└─────────┴─────────┴────────┴────────┴─────────┘
Lines of Code by Repository (Top 15)
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━┳━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━┓
┃ Repository ┃ PRs ┃ Commits ┃ Additions ┃ Deletions ┃ Total ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━╇━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━┩
│ agent-cli │ 187 │ 447 │ +456,555 │ -176,185 │ 632,740 │
│ glove80 │ 3 │ 171 │ +399,278 │ -101,727 │ 501,005 │
│ aijournal │ 23 │ 413 │ +226,087 │ -96,154 │ 322,241 │
│ compose-farm │ 148 │ 354 │ +104,679 │ -40,606 │ 145,285 │
│ assistant-ui-anywidget │ 3 │ 68 │ +88,792 │ -45,449 │ 134,241 │
│ glove80-tailorkey-hrm-tra… │ - │ 15 │ +67,317 │ -36,474 │ 103,791 │
│ home-assistant-config │ 7 │ 196 │ +96,970 │ -4,133 │ 101,103 │
│ dotbins │ 87 │ 382 │ +56,921 │ -28,684 │ 85,605 │
│ basnijholt │ 1 │ 182 │ +42,461 │ -39,521 │ 81,982 │
│ dotfiles │ 24 │ 878 │ +35,555 │ -16,168 │ 51,723 │
│ adaptive-lighting │ 22 │ 30 │ +29,316 │ -4,990 │ 34,306 │
│ lesdeuxchevaux │ 86 │ 90 │ +20,971 │ -6,913 │ 27,884 │
│ .dotbins │ - │ 102 │ +13,378 │ -12,303 │ 25,681 │
│ matty │ 4 │ 57 │ +16,119 │ -7,407 │ 23,526 │
│ nijho.lt │ 20 │ 126 │ +20,356 │ -1,812 │ 22,168 │
└────────────────────────────┴─────┴─────────┴───────────┴───────────┴─────────┘
Top 10 Contributions by Size
┏━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Ref ┃ Description ┃ Additions ┃ Deletions ┃ Date ┃
┡━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━┩
│ 339c987 │ glove80: Expand TailorKey │ +164,547 │ -113 │ 2025-11-09 │
│ │ variants for all alpha ... │ │ │ │
│ PR #224 │ agent-cli: feat(server): add │ +47,187 │ -21,668 │ 2026-01-15 │
│ │ Whisper ASR server wit... │ │ │ │
│ PR #88 │ agent-cli: Add memory-proxy │ +48,172 │ -7,943 │ 2025-11-23 │
│ │ based on SOTA systems b... │ │ │ │
│ becf3a3 │ glove80: Retire redundant │ +77 │ -54,763 │ 2025-11-08 │
│ │ sources/variants inputs │ │ │ │
│ 1db6c4c │ glove80: Add canonical layout │ +54,811 │ -0 │ 2025-11-08 │
│ │ sources and generat... │ │ │ │
│ 6568292 │ glove80: Add original files │ +54,684 │ -0 │ 2025-11-08 │
│ PR #5 │ aijournal: Data models │ +33,791 │ -16,493 │ 2025-10-31 │
│ 47d10c6 │ glove80-tailorkey-hrm-transf… │ +34,409 │ -0 │ 2025-11-07 │
│ │ Add base/HRM layer utilities │ │ │ │
│ 1294c50 │ glove80-tailorkey-hrm-transf… │ +0 │ -34,195 │ 2025-11-07 │
│ │ Prune intermediate layout │ │ │ │
│ │ snapshots │ │ │ │
│ PR #84 │ agent-cli: feat: add proxy │ +24,787 │ -2,305 │ 2025-11-20 │
│ │ RAG server │ │ │ │
└─────────┴───────────────────────────────┴───────────┴───────────┴────────────┘
Lines by File Extension (Top 15)
┏━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━┓
┃ Extension ┃ Additions ┃ Deletions ┃ Total ┃ % ┃
┡━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━┩
│ .py │ +639,983 │ -232,005 │ 871,988 │ 36.1% │
│ .json │ +499,306 │ -141,866 │ 641,172 │ 26.6% │
│ .md │ +220,367 │ -121,747 │ 342,114 │ 14.2% │
│ .js │ +127,403 │ -31,735 │ 159,138 │ 6.6% │
│ .lock │ +115,148 │ -24,765 │ 139,913 │ 5.8% │
│ .ipynb │ +38,825 │ -36,156 │ 74,981 │ 3.1% │
│ .nix │ +15,467 │ -8,490 │ 23,957 │ 1.0% │
│ .txt │ +15,816 │ -2,467 │ 18,283 │ 0.8% │
│ .sh │ +10,565 │ -5,801 │ 16,366 │ 0.7% │
│ .yaml │ +10,415 │ -5,831 │ 16,246 │ 0.7% │
│ keychain │ +7,931 │ -7,922 │ 15,853 │ 0.7% │
│ .html │ +11,329 │ -3,309 │ 14,638 │ 0.6% │
│ .tsx │ +7,648 │ -4,941 │ 12,589 │ 0.5% │
│ .yml │ +10,001 │ -1,596 │ 11,597 │ 0.5% │
│ .toml │ +7,530 │ -2,310 │ 9,840 │ 0.4% │
└───────────┴───────────┴───────────┴─────────┴───────┘
Activity Stats
Average lines per contribution: 484
Average PR size: 1,236 lines
Most productive day: Sun
Lines by day of week:
Mon: ▓▓▓▓▓▓▓▓▓ 213,687
Tue: ▓▓▓▓▓▓▓▓▓▓▓▓ 294,270
Wed: ▓▓▓▓▓▓▓▓▓▓ 250,674
Thu: ▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 324,756
Fri: ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 425,349
Sat: ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 441,004
Sun: ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 462,725
PR Size Distribution
<100: ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 378 ( 50.9%)
100-500: ▓▓▓▓▓▓▓▓▓▓ 194 ( 26.1%)
500-1K: ▓▓ 52 ( 7.0%)
1K-5K: ▓▓▓ 73 ( 9.8%)
>5K: ▓▓ 46 ( 6.2%)
Quality Indicators
Documentation: 14.9% of total lines
Test-related: ~6.9% of code lines (estimated)
Code churn: 36.4% (643,374 deleted per 1,769,091 added)
Total PRs: 743 (per-commit totals)
Direct commits: 4237
Total additions: +1,769,091
Total deletions: -643,374
Total lines changed: 2,412,465
Cache hits: 4980
Congratulations! You've written over a million lines of code since 1y!
Features
- Per-commit counting (default): Counts every line touched in every commit
- Net diff mode: Alternative mode that only counts final diff (
--net) - Direct commits: Includes commits pushed directly to main (not via PR)
- File extension breakdown: Shows which languages you've worked with
- JSON output: Machine-readable output for scripting (
--json) - Disk caching: Uses diskcache to avoid hammering the GitHub API
- Rate limit handling: Automatically waits when rate limited with progress bar
- Flexible dates: Supports relative (
5d,2w,3m,1y) and natural language (last month)
License
MIT License - see LICENSE for details.