2/08/2024

git find large big file which committed.

 Find large file in GitHub repository

.

git rev-list --objects --all | \
git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | \
awk '$3 > 100*1024*1024' | sort -k3nr


..

  • git rev-list --objects --all lists all objects in the repository.
  • git cat-file --batch-check='...' checks the type, size, and other details of these objects.
  • awk '$3 > 100*1024*1024' filters objects larger than 100 MB (note: 1024*1024 bytes = 1MB).
  • sort -k3nr sorts these objects by size in descending order.

πŸ™‡πŸ»‍♂️

No comments:

Post a Comment