Skip to content

Instantly share code, notes, and snippets.

@OhadRubin
Created February 13, 2023 15:46
Show Gist options
  • Save OhadRubin/6fa3a97e977443524e3bc4b6a1596620 to your computer and use it in GitHub Desktop.
Save OhadRubin/6fa3a97e977443524e3bc4b6a1596620 to your computer and use it in GitHub Desktop.
Prints out the most changed files in a repo
import os
counts = {}
for hash in os.popen('git log --all --format=%H'):
hash = hash.strip()
os.system('git checkout {}'.format(hash))
for fname in os.popen('git diff --name-only HEAD^ HEAD'):
fname = fname.strip()
counts[fname] = counts.get(fname, 0) + 1
print('Most changed files:')
print('-------------------')
for fname, count in sorted(counts.items(), key=lambda x: x[1], reverse=True):
print('{}: {}'.format(count, fname)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment