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

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

问题描述

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


  1. 手动复制二进制文件。


    • 亲:不确定。

    • Contra:我强烈反对,因为它增加了错误发生的可能性建立一个新的网站/迁移旧的网站。构建另一个障碍。


  2. 使用 Git 管理它们。


    • 临:删除'忘记'复制重要文件的可能性
    • Contra:扩充存储库并减少


  3. 单独的软件仓库,用于管理代码库和签出,克隆等。


    • 临:检出/克隆源代码的速度一如既往,并且图像已正确存档在自己的存储库中。

    • Contra:删除在项目中拥有唯一 Git存储库的简单性。它肯定会介绍一些其他我没有想过的事情。


什么是关于这方面的经验/想法?

另外:是否有人有多个Git仓库的经验并在一个项目中管理它们?



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

解决方案

一个单独的回购是一个坏主意。我们有大型测试套件,我们将其分成单独的回购,但这些都是真正的辅助文件。

然而,您可能能够在单独的回购库中管理文件然后使用 git-submodule 以一种理智的方式将它们引入您的项目。所以,你仍然拥有所有源代码的完整历史记录,但据我所知,你只有一个相关版本的图像子模块。 git-submodule 工具可以帮助您保持正确版本的代码与正确版本的图片保持一致。



以下是Git Book的子模块简介


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. Copy the binary files by hand.
    • Pro: Not sure.
    • Contra: I am strongly against this, as it increases the likelihood of errors when setting up a new site/migrating the old one. Builds up another hurdle to take.
  2. Manage them all with Git.
    • Pro: Removes the possibility to 'forget' to copy a important file
    • Contra: Bloats the repository and decreases flexibility to manage the code-base and checkouts, clones, etc. will take quite a while.
  3. Separate repositories.
    • 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?

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

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.

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.

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

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

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