Skip to content

Commit d19fffc

Browse files
committed
Added find-large-files.sh
used to scan git gistory and find lard files. Results sorted by size
1 parent 9cad3d7 commit d19fffc

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

git/find-large-files.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
git rev-list --objects --all |
2+
git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' |
3+
sed -n 's/^blob //p' |
4+
awk '$2 >= 2^20' |
5+
sort --numeric-sort --key=2 |
6+
cut -c 1-12,41- |
7+
$(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest
8+
9+
# example output
10+
# 22c19f287836 1.0MiB images/posts/1.gif
11+
# 0e15a02b835a 1.2MiB images/posts/2.gif
12+
# f48d3086bf1d 1.5MiB images/posts/3.gif
13+
# eecf2e1d46a7 1.6MiB images/posts/4.gif
14+
# a267f286e7f2 1.7MiB images/posts/5.gif
15+
# 225cba92676b 3.4MiB images/posts/6.gif
16+
17+
# to find commits with SHA use
18+
# git log --raw --all --find-object=225cba92676b
19+
20+
# to find all files with given extension
21+
# git log --all --full-history -- *.gif

0 commit comments

Comments
 (0)