简体   繁体   English

如何减少git仓库的大小

[英]how to reduce size of git repository

I have a git repository with lots of pdf and zip files. 我有一个包含大量pdfzip文件的git存储库。 Can git treat them as just a file name? git可以将它们视为文件名吗? in this case, the repo should be very small. 在这种情况下,回购应该非常小。

I have tried to add a .gitattributes with the following lines: 我尝试使用以下行添加.gitattributes

*.zip   binary
*.pdf   binary 

After I commit, the .git directory is still very large. 提交后, .git目录仍然很大。 Is there a way to reduce the size of my repository? 有没有办法减少我的存储库的大小?

Any solution is welcome. 欢迎任何解决方案。 such as recreate a new repository. 例如重新创建一个新的存储库。 The commit history is not important for me. 提交历史对我来说并不重要。

Thanks in advance. 提前致谢。

I use the command 我用这个命令

git archive <branch> > file.zip

And, ... I think that your repository do not care about zip and pdf: you really need to version documents? 并且,...我认为您的存储库不关心zip和pdf:您真的需要版本文档吗? I think the best way is to version only code. 我认为最好的方法是仅版本代码。 Documents should be stored in another place, like data: data are often stored in a database and database is never part of the repository. 文档应存储在其他位置,如数据:数据通常存储在数据库中,数据库永远不是存储库的一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM