How can I search my git logs to see which files have had the most activity?
Here's a python script that you can pipe the log --numstat output through to get the results:
import sys, re
res = {}
while 1:
line = sys.stdin.readline()
if len(line) == 0:
break;
m = re.match("([0-9]+)[ \t]+([0-9]+)[ \t]+(.*)", line)
if m != None:
f = m.group(3)
if f not in res: res[f] = {'add':0, 'rem':0, 'commits':0}
res[f]['commits'] += 1
res[f]['add'] += int(m.group(1))
res[f]['rem'] += int(m.group(2))
for f in res:
r = res[f]
print "%s %s %s %s"%(r['commits'], r['add'], r['rem'], f)
You can modify it as needed to sort/filter how you want.