Skip to content

Instantly share code, notes, and snippets.

@dustin
Created November 17, 2008 07:10
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 dustin/25683 to your computer and use it in GitHub Desktop.
Save dustin/25683 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
"""
A script to tell you who actually wrote your current codebase.
Usage:
git ls-files | xargs -n 1 git annotate | ./who-wrote-this.py
Copyright (c) 2008 Dustin Sallings <dustin@spy.net>
"""
import fileinput
total_lines=0
authors={}
for l in fileinput.input():
total_lines += 1
x=l.split("\t", 3)[1]
a=x[1:].strip()
authors[a] = authors.get(a, 0) + 1
for n, a in sorted([(v,k) for k,v in authors.iteritems()], reverse=True):
print a, n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment