Reputation: 3973
I earlier pushed many files to git, many of them where unwanted. I followed the following to remove those unwanted files (jar/lib/ide files etc).
Basically I did,
git filter-branch -f --index-filter 'git rm --cached --ignore-unmatch target'
I verified in github those files don't exist anymore. When I download my repo as zip in github its less than 1MB, however when I do a git clone, its still 100MB.
Upon further research I found after cloning,
MyRepo/.git/objects/pack/pack-b6b2b82ecd58c551c3648b9ca97e4f8b29rrt3c2.pack
is 99.8 MB. How can I get rid of this?
Upvotes: 1
Views: 322
Reputation: 25179
It sounds like you missed the last step of the first link (step 9):
git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin
git reflog expire --expire=now --all
git gc --prune=now
The git gc
garbage collects.
I'd add that you should make sure you do not accidentally git push
back the bloated content. I suggest removing local copies of all repositories and recloning once you are sure it works.
The second link you suggested almost entirely deals with removing the file from the repository as a commit; if you do this, you will still be able to check out a revision prior to the commit, so the contents of the file must obviously still be somewhere, hence your git clone
does not reduce in size.
Upvotes: 1