Skip to content

Instantly share code, notes, and snippets.

@pstef
Created April 26, 2025 21:28
Show Gist options
  • Save pstef/8c4f3288ec91decf47e6b4d774d89bc5 to your computer and use it in GitHub Desktop.
Save pstef/8c4f3288ec91decf47e6b4d774d89bc5 to your computer and use it in GitHub Desktop.
BEGIN {
FS = OFS = "\t"
}
$0 == "" { next }
NF == 2 {
current_author = $1
commits[current_author]++
next
}
NF == 3 {
insertions[current_author] += ($1 + 0)
deletions[current_author] += ($2 + 0)
files[current_author][$3] = 1
next
}
{
print "Unexpected line (NR=" NR "): " $0 > "/dev/stderr"
current_author = "Unknown"
}
END {
print "Author", "Commits", "UniqueFiles", "Insertions", "Deletions"
for (author in commits)
print author, commits[author], length(files[author]), insertions[author] + 0, deletions[author] + 0
}
git log --pretty=format:$'"%aN"\t%H' --numstat --no-merges | awk -f contributions.awk > contributors.tsv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment