Created
February 13, 2023 15:46
-
-
Save OhadRubin/6fa3a97e977443524e3bc4b6a1596620 to your computer and use it in GitHub Desktop.
Prints out the most changed files in a repo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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