Reputation: 11321
I have a very long list of repos that I'm trying to make into one parent repo by making them all submodules.
I've tried adding them to .gitmodules
manually, and also to .git/config
, but it doesn't seem to work.
I've also tried running git submodule sync
and git submodule update --init
, etc, but with no luck.
Is there a way to trick git into thinking my project has all its (~30K) submodules, without actually needing to clone them all?
Upvotes: 35
Views: 11428
Reputation: 142084
Is there a way to trick git into thinking my project has all its (~30K) submodules, without actually needing to clone them all?
??? ~30K submodules ?
Are u trying to clone all github repositories?
It makes no sense to have so many submodules in a single project.
Is there a way to trick git into thinking my project has all its
Nope, this is what submodule is used for, to contain 3rd party (can be yours as well) dependency which will be managed in its own repository.
As you can see in the image submodule is simply a sub-project inside your project. What you are asking is if there is way to tell git that I have the project while we don't have it at all.
It cant be done.
Upvotes: -5
Reputation: 3361
After a long walk on the internet, I found out that you can achieve what you want by writing directly in the git index and create the “gitlink” file type.
git update-index [--add] --cacheinfo 160000 <subrepo commit hash> <submod path>
Also do not forget to write the subrepo in .gitmodules
(declare the external path, mostly).
Upvotes: 37