Skip to content

Instantly share code, notes, and snippets.

@benjamincharity
Created August 9, 2017 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjamincharity/1d265b50025439a99d2e6c993433c48b to your computer and use it in GitHub Desktop.
Save benjamincharity/1d265b50025439a99d2e6c993433c48b to your computer and use it in GitHub Desktop.
Git alias function to show how many lines were authored by each contributor.
[alias]
linesperauthor = "!f() { \
git ls-files | while read f; do git blame --line-porcelain $f | grep '^author '; done | sort -f | uniq -ic | sort -n; \
}; f"
# usage:
# git linesperauthor
# output:
# 2 Binary file (standard input) matches
# 3 author Not Committed Yet
# 668 author Matt Sanders
# 1428 author Roger Dapp
# 8027 author Benjamin Charity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment