Refer to
git command tips: big files and remove in all branches
https://blog.csdn.net/hushui/article/details/103361663
1. git find big files
lake@localhost: aosp_git_android$ git rev-list --all | xargs -rL1 git ls-tree -r --long | sort -uk3 | sort -rnk4 | head -30
100755 blob 616fd51c22f67b30708115cb0d58e9a128ea8619 176982200 prebuilts/qemu-kernel/x86/ranchu/vmlinux-qemu
100755 blob 06f9c90f973d9e0d1816d1f19c1504d6c3533337 172926076 prebuilts/qemu-kernel/x86/ranchu/vmlinux-qemu
2.
git rev-list --objects --all | grep "$(git verify-pack -v .git/objects/pack/*.idx | sort -k 3 -n | tail -20 | awk '{print$1}')"
30c3408fb9b4c487b0dc9023889746e96c62c8f1 device/google/wahoo-kernel/unstripped/wlan.ko
e61719158b2b0ef3de7d228559c602ca1f9372a0 prebuilts/android-emulator/linux-x86_64/lib64/vulkan/libvk_swiftshader.so
1edca352c40c19e9272d1bf4e02648049151e579 prebuilts/jdk/jdk9/linux-x86/lib/modules
aa8c07355e8ee9014f5b054c9f27877ee95cbbd3 prebuilts/tools/linux-x86_64/bazel/bazel-real
b64f1da63d2e11e6451232323cbfeb222d631589 tools/dexter/testdata/expected/large.code_coverage
c533319338c73769949026dc991740316eb49dca tools/dexter/testdata/expected/large.verbose_cfg
408def27627ae670609a2858102bc082f0b8010e device/google/bonito-kernel/test/un/wlan.ko
c61e311999b89323a9dc403c8ddb9f8d2a14e145 device/google/bonito-kernel/unstripped/wlan.ko
3. alias in .gitconfig
[alias]
big-files = !"git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| sed -n 's/^blob //p' \
| sort -nk2 \
| cut -c 1-12,41- \
| $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest"
big-objects = !"git rev-list --all \
| parallel git ls-tree -r --long "{}" \
| sort -uk3 \
| sort -nk4"
Example
[lhu3@zch127bld08 git-aosp-AndroidN7.1.x]$ git big-files
..............
aa8c07355e8e 128MiB prebuilts/tools/linux-x86_64/bazel/bazel-real
e1e8265feda7 129MiB prebuilts/qemu-kernel/x86_64/ranchu/vmlinux-qemu
3ecfb46207b7 132MiB prebuilts/qemu-kernel/x86_64/ranchu/vmlinux-qemu
a84c6778c2de 135MiB external/eclipse-basebuilder/src/eclipse-sourceBuild-srcIncluded-3.6.2.zip
c533319338c7 136MiB tools/dexter/testdata/expected/large.verbose_cfg
1edca352c40c 137MiB prebuilts/jdk/jdk9/linux-x86/lib/modules
c61e311999b8 140MiB device/google/bonito-kernel/unstripped/wlan.ko
b64f1da63d2e 142MiB tools/dexter/testdata/expected/large.code_coverage
7cb2fa945c42 142MiB device/google/crosshatch-kernel/unstripped/wlan.ko
408def27627a 143MiB device/google/bonito-kernel/test/un/wlan.ko
06f9c90f973d 165MiB prebuilts/qemu-kernel/x86/ranchu/vmlinux-qemu
616fd51c22f6 169MiB prebuilts/qemu-kernel/x86/ranchu/vmlinux-qemu
e2ad83091c8a 233MiB external/caffe-on-acl/CaffeOnACL/models/bvlc_alexnet/bvlc_alexnet.caffemodel
e61719158b2b 477MiB prebuilts/android-emulator/linux-x86_64/lib64/vulkan/libvk_swiftshader.so