简体   繁体   中英

What's wrong with nested git repos?

I am in a situation where I cannot use submodules (or subtrees, I believe), and I can only use vanilla nested repos (the reason is somewhat unusual, but it has to do with building inside a docker container).

In general, what are the issues with nesting vanilla git repos in this manner?

A nested Git repo has no problem, except its parent repo will see it as a gitlink (a special entry in its index, representing a SHA1)

The problem is: that SHA1 reference has no URL reference, so cloning again the parent repo will lead to an empty folder, because the parent repo does not know where to search for the nested Git repo.
This differ from a submodule, which records the gitlink (same as a nested repo) and the URL of the nested repo (in a special file: .gitmodules )

If your parent repo ignore (in a .gitignore ) the nested repo enntry, then both can co-exist without issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM