git子模块是在工作副本中拥有工作副本的唯一安全方式吗? [英] Are git submodules the only safe way to have working copies within working copies?

查看:93
本文介绍了git子模块是在工作副本中拥有工作副本的唯一安全方式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的情况下,我有一个程序分析数据输入文件并生成其他数据输出文件。我想对版本控制程序进行版本控制,并且我想要版本控制数据文件,并且作为首选项,我希望在程序的工作副本中包含数据文件的工作副本。我希望程序和数据分开版本控制,以减少噪音。该程序不依赖于数据文件。



如果我使用git子模块,那么当数据目录内发生事情时(我认为提交的更新),版本控制程序注意到子模块有更新。如果程序依赖于数据,那么这很有用,但它不会。



在这种情况下,是否有可能在另一个工作中有工作副本不使用git子模块复制副本?

解决方案

可以简单地在Git中嵌套工作副本。因此,如果你克隆你的程序库,那么在你的数据文件的克隆中,你可以单独使用它们。当Git执行文件操作时,它会搜索目录树来查找 .git 目录,因此在数据存储库中执行的Git操作不会影响程序库。如果你这样做,你可能想要将数据目录的名称添加到 .gitignore 中以减少程序存储库中的噪音。


In my scenario, I have a program that analyzes data input files and produces other data output files. I want to version control the program, and I want to version control the data files, and as a matter of preference, I want to have the working copy of the data files within the working copy of the program. I want the program and data to be version controlled separately to reduce "noise". The program does not have a dependency on the data files.

If I use git submodules, then when things happen within the data directory (committed updates I think), the version control for the program notes that there's an update with the submodule. Which'd be useful if the program depended on the data, but it doesn't.

In such a scenario, is it possible to have a working copy within another working copy without using git submodules?

解决方案

It's possible to simply "nest" working copies in Git. So if you clone your program repository, then inside that make a clone of your data files, then you can work with them independently. When Git performs file operations, it searches up the directory tree looking for a .git directory, so Git operations performed in the data repository won't affect the program repository. If you do this, you may want to add the name of the data directory to .gitignore to reduce noise from the program repository.

这篇关于git子模块是在工作副本中拥有工作副本的唯一安全方式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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