Git Repository Too Large

旧街凉风 提交于 2019-12-05 18:37:20

问题


I have a project with ~12MB worth of code and assets in it. I've been tracking it using Git, and just noticed that my .git folder is now just over 1.83GB. It consists of a few small files, and then just one pack file that makes up about 1.82GB of the folder.

I've run git gc --aggressive and git gc --prune. It's the same size. I've tried:

git reflog expire --expire=now --all
git repack -ad  # Remove dangling objects from packfiles
git prune       # Remove dangling loose objects

But it's still the same size. I've even cloned it (once locally with a forced repack, and once again from Git), but it's still 1.83GB on each. Is that normal? Is there any way to reduce the size of it, or do I just start a new repo, copy the code over, and accept that my past commits will be gone?


回答1:


Ok, the comments were a great start to understand what the root cause of the problem probably was. I don't really understand the git filter-branch command though, so I was a little wary of just using that.

I came across this tool: http://rtyley.github.com/bfg-repo-cleaner/

It worked wonders. My repo is now under 10MB.



来源:https://stackoverflow.com/questions/15606177/git-repository-too-large

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!