How to shrink the .git folder

You should not delete all changes older than 30 days (I think it’s somehow possible exploiting Git, but really not recommended).

You can call git gc --aggressive --prune, which will perform garbage collection in your repository and prune old objects. Do you have a lot of binary files (archives, images, executables) which change often? Those usually lead to huge .git folders (remember, Git stores snapshots for each revision and binary files compress badly)

Leave a Comment