Skip to content

raksbisht/blame-yourself

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blame-yourself

npm version downloads license node

Answer the question: "How much of this codebase did I actually write?"

Runs git blame across your entire repo and surfaces your authorship stats —
lines written, ownership %, language breakdown, team leaderboard, and more.


Install

npm install -g blame-yourself

or run instantly with no install:

npx blame-yourself

Demo

blame-yourself

  You (Jay Smith <[email protected]>)
  ─────────────────────────────────────
  Lines authored:  1,243 / 4,891
  Ownership:       25.4%
  Files touched:   38 / 102

  Commits:         147
  First commit:    Mar 04, 2024
  Last commit:     Mar 18, 2026
  Team rank:       2nd of 6 contributors

  Languages (by lines authored):
  ─────────────────────────────────────
  ts          ████████████████████  834 (28.1% of file)
  tsx         ████████████░░░░░░░░  312 (19.4% of file)
  css         ████░░░░░░░░░░░░░░░░  97 (31.2% of file)

  Contributors (by lines):
  ─────────────────────────────────────
  Jay Smith               ████████████████  1,243 (25.4%) ← you

  Top files by lines authored:
  ─────────────────────────────────────
  src/components/Editor.tsx            ████████████████████  214 (61.3%)
  src/lib/parser.ts                    ████████████░░░░░░░░  156 (44.2%)
  src/styles/main.css                  ████████░░░░░░░░░░░░  97 (31.2%)

Usage

# Whole repo
blame-yourself

# Specific files
blame-yourself src/index.ts README.md

# Glob pattern — quote to prevent shell expansion
blame-yourself "src/**"
blame-yourself "**/*.ts"

# Multiple globs
blame-yourself "src/**" "lib/**" "*.config.js"

# Via flag (same as positional)
blame-yourself --path "src/**"

# Help
blame-yourself --help

What it shows

Section Description
📝 Lines authored Lines git blame attributes to your user.email
📊 Ownership % Your lines as a share of all tracked, non-binary lines
📁 Files touched Files where you own at least one line
🔖 Commits Your total commit count via git log --author
📅 First / Last commit When you first contributed and last touched the repo
🏆 Team rank Your position among all contributors by lines owned
🌐 Languages Top 5 file extensions by lines authored, with per-type %
👥 Contributors Full team leaderboard ranked by lines owned
🗂️ Top files Your 10 most-authored files with bar charts

How it works

git ls-files          →  all tracked files (respects .gitignore)
     ↓
  filter              →  skip lockfiles, binaries, assets
     ↓
git blame --porcelain →  parse author-mail per line
     ↓
  match email         →  compare against git config user.email
     ↓
  aggregate           →  lines, files, languages, contributors
     ↓
  render              →  colored terminal output

Accuracy note: the porcelain format only emits author metadata once per unique commit hash. blame-yourself caches each hash on first sight so every repeated-commit line is still correctly attributed.


Filtered automatically

Lockfiles and binary files are always skipped so they don't skew your numbers.

Lockfiles

package-lock.json · yarn.lock · pnpm-lock.yaml · Gemfile.lock · Cargo.lock · poetry.lock · Pipfile.lock · composer.lock · *.lock

Binary & asset extensions

Category Extensions
Images .png .jpg .jpeg .gif .webp .svg .ico .bmp
Fonts .woff .woff2 .ttf .otf .eot
Archives .zip .tar .gz .bz2 .7z
Media .mp3 .mp4 .wav .mov .webm
Compiled .pyc .class .dll .so .dylib

Files that cause git blame to error are silently skipped.


Requirements

Node.js >= 18
Git Installed and on your PATH
Location Must run from inside a git repository
Identity git config user.email must be set

FAQ

It shows 0% even though I wrote everything

Your git config user.email must exactly match the email on your commits:

git config user.email               # what the tool uses
git log --format="%ae" | sort -u    # emails recorded in commits

If they differ, either update your config or amend your commits.

Numbers look wrong in a large repo

Files over 50 MB are skipped to avoid memory issues. This rarely affects line counts in practice. All lockfiles and binaries are also excluded — run with a --path filter if you want to scope to a specific directory.

Can I check someone else's stats?

Not yet — --author <email> support is planned for a future release.

Why is it slow on large repos?

git blame has to read every line of every file. On repos with thousands of files this takes time — the progress indicator shows which file is being processed. Use --path to scope to a subdirectory for faster results:

blame-yourself "src/**"

Author

Made by Rakesh Bisht


License

MIT

About

Answer "how much of this codebase did I actually write?" — runs git blame across your entire repo and shows your authorship stats: lines owned, ownership %, language breakdown, team leaderboard, and top files.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Contributors