使用 Git 管理大型二进制文件 [英] Managing large binary files with Git

查看:50
本文介绍了使用 Git 管理大型二进制文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找有关如何处理我的源代码(Web 应用程序)所依赖的大型二进制文件的意见.我们目前正在讨论几种替代方案:

I am looking for opinions of how to handle large binary files on which my source code (web application) is dependent. We are currently discussing several alternatives:

  1. 手动复制二进制文件.
    • 专家:不确定.
    • Contra:我强烈反对这一点,因为它会增加设置新站点/迁移旧站点时出错的可能性.建立了另一个需要克服的障碍.
  • Pro:消除忘记"复制重要文件的可能性
  • 相反:使存储库膨胀并降低管理代码库和检出、克隆等的灵活性,这将需要很长时间.
  • 优点:检出/克隆源代码一如既往地快速,而且图像已正确存档在自己的存储库中.
  • Contra:消除了项目中唯一 Git 存储库的简单性.它肯定会介绍一些我没有想到的其他东西.
  • Pro: Checking out/cloning the source code is fast as ever, and the images are properly archived in their own repository.
  • Contra: Removes the simpleness of having the one and only Git repository on the project. It surely introduces some other things I haven't thought about.

您对此有何经验/想法?

What are your experiences/thoughts regarding this?

另外:有没有人有使用多个 Git 存储库并在一个项目中管理它们的经验?

Also: Does anybody have experience with multiple Git repositories and managing them in one project?

这些文件是用于生成包含这些文件的 PDF 的程序的图像.这些文件不会经常更改(如几年),但它们与程序非常相关.没有这些文件,程序将无法运行.

The files are images for a program which generates PDFs with those files in it. The files will not change very often (as in years), but they are very relevant to a program. The program will not work without the files.

推荐答案

如果程序在没有文件的情况下无法运行,那么将它们拆分为单独的存储库似乎是个坏主意.我们有大量的测试套件,我们将它们分解成一个单独的存储库,但这些都是真正的辅助"文件.

If the program won't work without the files it seems like splitting them into a separate repo is a bad idea. We have large test suites that we break into a separate repo but those are truly "auxiliary" files.

但是,您可以在单独的存储库中管理文件,然后使用 git-submodule 以理智的方式将它们拉入您的项目.因此,您仍然拥有所有源的完整历史记录,但据我所知,您只有图像子模块的一个相关修订版.git-submodule 工具应该可以帮助您使正确的代码版本与正确的图像版本保持一致.

However, you may be able to manage the files in a separate repo and then use git-submodule to pull them into your project in a sane way. So, you'd still have the full history of all your source but, as I understand it, you'd only have the one relevant revision of your images submodule. The git-submodule facility should help you keep the correct version of the code in line with the correct version of the images.

这是来自 Git Book 的一个很好的子模块介绍.

Here's a good introduction to submodules from Git Book.

这篇关于使用 Git 管理大型二进制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆