Dec. 23, 2024
PACK files in .git - a rabbit hole
- so, how did we get here? :see_no_evil:
git stores all historical changes to a repo in a PACK file inside the hidden .git folder. This allows restoration of previous repo states in the future.
However, if you upload files like binaries, photos or videos, this file gets VERY large, even if you delete them in a future commit.
- enter: git-filter-repo
Luckily a tool exists called git-filter-repo that you can download and use (python script) to analyse your PACK file, and filter out any unwanted bits (e.g. file extensions, paths, etc.). This can dramatically reduce the size of the PACK file.