Created
April 16, 2022 14:27
-
-
Save pansila/c0b9fb5c8bf89f3928d62603b8ccd416 to your computer and use it in GitHub Desktop.
List all Git repository objects by size
This file contains 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 subprocess | |
from tqdm import tqdm | |
files = [] | |
commitSHA1 = subprocess.check_output(['git', 'rev-list', '--all'], text=True) | |
for c in tqdm(commitSHA1.splitlines()): | |
files.extend(subprocess.check_output(['git', 'ls-tree', '-r', '--long', c], text=True).splitlines()) | |
files.sort(key=lambda x: x.split()[2]) | |
files = list(set(files)) | |
files.sort(key=lambda x: int(x.split()[3]), reverse=True) | |
print('\n'.join(files[:100])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Need from https://gist.github.com/magnetikonline/dd5837d597722c9c2d5dfa16d8efe5b9