为什么在我的项目中 git 文件大小非常大?

Why in my project git file size very large?

我的项目使用 git。我们开发这个项目大约 2 年。现在这个 .git 文件是 908.3 MB。 我认为这个大小不正常,所以我想减小 git 的文件大小。那么如何修复它们呢?谢谢。

尝试清除大文件存储库的历史记录:使用新工具 git filter-repo which replaces BFG and git filter-branch

git filter-repo --strip-blobs-bigger-than 10M

然后检查 .git 文件夹的大小。
确保您的存储库历史记录中不需要那些大文件。

注意:如果在运行执行上述命令时出现以下错误信息:

Error: need a version of `git` whose `diff-tree` command has the `--combined-all-paths` option`

这意味着你必须update git