| Crates.io | git-loc |
| lib.rs | git-loc |
| version | 0.3.0 |
| created_at | 2025-12-26 11:34:25.149237+00 |
| updated_at | 2026-01-16 05:52:35.202715+00 |
| description | Per-language lines of code time series from git history using git blobs + tokei |
| homepage | |
| repository | https://github.com/banteg/git-loc |
| max_upload_size | |
| id | 2005604 |
| size | 85,993 |
Generate a per-language lines of code time series for a Git repository without checking out each commit.
This tool walks the linear history of a branch/ref, computes a tree diff at each commit, and updates running totals using git blob contents + tokei for language detection and counting.
code / comments / blanks counts (including embedded-language blobs).Note: “lines of code” usually refers to the
codecolumn (non-blank, non-comment lines). The CSV also includescomments,blanks, andlines = code+comments+blanks.
cargo install git-loc
git clone https://github.com/banteg/git-loc.git
cd git-loc
cargo install --path .
git-loc --repo .
git-loc --repo . --out loc.csv --plot loc.svg
# Use code/comments/blanks/lines for the plot metric
git-loc --repo . --out loc.csv --plot loc.svg --plot-metric code
# Plot top 5 languages
git-loc --repo . --out loc.csv --plot loc.svg --plot-top 5
# Show git tags on the plot
git-loc --repo . --out loc.csv --plot loc.svg --plot-tags
# Only include selected languages (repeatable or comma-separated)
git-loc --repo . --out loc.csv --plot loc.svg --only Python --only "Jinja2"
git-loc --repo . --out loc.csv --plot loc.svg --only Python,Jinja2
git-loc --repo . --subdir src --out loc.csv --plot loc.svg
git-loc --repo . --no-progress
The CSV is long-form: one row per (commit, language).
Columns:
commit: commit SHAtimestamp: commit time (unix seconds)datetime: commit timelanguage: language name (as reported by tokei)code: code linescomments: comment linesblanks: blank lineslines: code + comments + blanksThis long format is convenient for plotting.
--plot <path.svg> writes an SVG chart of the top languages ranked by totals at the final commit.
Plot-related flags:
--plot-metric code|lines|comments|blanks (default: code)--plot-top N (default: 8)--plot-tags shows git tags on the plot--only <LANG> repeatable or comma-separated--no-progress disables the progress bar on stderr--rev (default HEAD).parent_tree → commit_treeCounting is done by writing blob bytes to a temporary file (with the original basename so tokei’s path-based detection works), then calling tokei as a library.