Find the largest files in the entire Git history
why is my git repository so large | find large files in git history | git clone takes forever | git | disk-space | repositorygit rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | awk '$1=="blob"' | sort -k3 -rn | head -n 20Collects all objects that appear in any commit, queries their size and sorts the files (blobs) in descending order. The columns are type, hash, uncompressed size in bytes and path. Typical finds are accidentally committed database dumps, backups or videos.
Note: Files that have already been deleted show up too, since they still exist in the history. Removing them for good requires rewriting history, for example with git filter-repo.
Also searched as
- why is my git repository so large
- find large files in git history
- git clone takes forever