Skip to content

Instantly share code, notes, and snippets.

@akhenda
Forked from tijn/git-lines-per-author.sh
Created January 11, 2019 00:47
Show Gist options
  • Save akhenda/0ae8c2f07ada850b3c5953674af89592 to your computer and use it in GitHub Desktop.
Save akhenda/0ae8c2f07ada850b3c5953674af89592 to your computer and use it in GitHub Desktop.
Produce a histogram with lines of code per author.
#!/bin/sh
git ls-tree -r HEAD | sed -Ee 's/^.{53}//' | \
while read filename; do file "$filename"; done | \
grep -E ': .*text' | sed -E -e 's/: .*//' | \
while read filename; do git blame --line-porcelain "$filename"; done | \
sed -n 's/^author //p' | \
sort | uniq -c | sort -rn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment