[英]How to disable submodules functionality for git repo with nested git repos?
I have following repo structure: 我有以下回购结构:
/repo
.git/
subrepo1/
.git/
...
dir/
subrepo2/
.git/
...
...
subrepoN/
.git/
...
subrepo
s are updated externally, but don't necessarily have a remote. subrepo
s是在外部更新的,但不一定要有一个遥控器。 repo
's purpose is to track all subrepo
's updates and introduce new changes in a single place. repo
的目的是跟踪所有subrepo
的更新,并在一个地方引入新的更改。 Updates will form a "vanilla" branch inside repo
, which then will be periodically merged to "dev" branch. 更新将在repo
内形成一个“ vanilla”分支,然后将其定期合并到“ dev”分支。 That's the intended workflow. 这就是预期的工作流程。 Git by default refuses to track subrepo
's files, assuming they are non-configured submodules. 默认情况下,Git拒绝跟踪subrepo
的文件, subrepo
是它们是未配置的子模块。
Questions is how do I disable such behaviour? 问题是如何禁用这种行为? I don't want to use submodules. 我不想使用子模块。 I want Git to stop treating subrepo
s as submodules, ignore every subrepo
's .git
directory while keeping it, and to track all files from subrepo
s. 我希望Git停止将subrepo
视为子模块,在保留它的同时忽略每个subrepo
的.git
目录,并跟踪subrepo
的所有文件。 Preferably in repo
's .git/config
file. 最好在repo
的.git/config
文件中。
I looked through git manual, tried various things and couldn't acheive this. 我翻阅了git manual,尝试了各种尝试,但仍无法实现。 There is a valueable workaround , but it still requires to execute git add <subrepo-path>/
for each subrepo
. 有一个有价值的解决方法 ,但仍然需要对每个subrepo
执行git add <subrepo-path>/
。 Subtree approach isn't desireable, because it seemingly doubles space consumed and adds complexity. 子树方法不是可取的,因为它看起来使空间消耗增加了一倍,并且增加了复杂性。
I don't think there is a simple way. 我认为没有简单的方法。 Either you have to remove or rename .git/
in subfolders or edit git sources (and recompile git) to disable recognition of .git/
as submodules. 您必须在子文件夹中删除或重命名.git/
,或者编辑git源(并重新编译git)以禁用将.git/
识别为子模块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.