Git 与 SVN 需要多少空间?
我们目前使用 Subversion 作为我们的源代码存储库。我们正处于转换为 Git 的规划阶段。我们的 Subversion 存储库目前为 19Gb。在磁盘空间要求方面,Git 存储库与 Subversion 相比如何?我的 19Gb svn 存储库将转换为 Git 存储库中的内容。
We are currently using Subversion as our source code repository. We are in the planning phase of converting to Git. Our Subversion repository is currently 19Gb. How does a Git repository compare to Subversion on disk space requirements? What will my 19Gb svn repository translate to in a Git repository.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
很难猜测你的 Git 存储库的确切大小,因为它取决于几个因素,例如
Git 有一个很好的压缩算法,根据我过去的经验,它能够将 SVN 存储库的大小减少多达 10 倍。 这里有一些示例。
然而,最好的方法是亲自尝试。在本地计算机上,您可以将 SVN 存储库转换为 Git
,然后运行 git gc 并查看需要多少空间来启动。
It's hard to guess the exact size that your Git repository will take because it depends on several factors, for instance
Git has a good compression algorithm and, from my past experience, it was able to reduce the size of a SVN repository up to 10 times. Here's some examples.
However, the best way is to try it yourself. On your local machine you can convert the SVN repository into Git
then run
git gc
and see how much space you need to start.由于 git 在每台机器上保留整个存储库,因此它还存储完整的历史记录,如果您添加然后删除了一个大文件,您会注意到实际上磁盘空间并没有减少。如果您完全确定要永久删除文件,则需要在 git 中运行特殊命令。
今天,我使用 git svn 命令将我的 svn 存储库之一移至 git,该命令不仅允许您移动当前数据,还可以移动历史数据。这就是我所得到的。
我的电脑上当前的 svn 存储库大小为 1.27 GB,新创建的 git 存储库大小为 3.24 GB。这是因为 git repo 包含整个历史记录,被删除的文件实际上并没有在 git 中删除,除非你像我上面提到的那样明确地执行此操作。
如果您在迁移到 git 时发现任何问题,您可以寻找答案这里
As git keeps the whole repo on each machine, it also stores the full history and if you have added and then deleted a large file, you will notice that actually the disk space hasn't been decreased. If you are completely sure you want to permanently delete file, you need to run special commands in git.
Today I moved one of my svn repos to git using the git svn command, which allows you to move not only current data but also history. And here is what I've got.
The current svn repo size on my pc is 1.27 GB, the newly created git repo is 3.24 GB. This is because git repo contains the whole history, the deleted files are not actually deleted in git, until you do it explicitly like I mentioned above.
If you find any problems while moving to git you may look for answers here