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
manual
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.
Just use git add
.
The git submodule
command is just there to help wrangle nested repositories.
Some people prefer simple abstractions that dictate and limit what can be done with arbitrarily complicated concrete implementations.
Git prefers simple implementations that can be made to do unlimited, arbitrary things, relegating abstractions to their proper role as assistants, ways of talking about what's possible. Trying to fit all the things you can do with a dag of snapshots into the blinkered straitjacket of vcs abstractions is crazy-making. A submodule is just a dag reference. "Put the tip of this dag here". The submodule command is just tools to help you hunt down a source for that dag and protect it from all the violent things you do to your poor overworked filesystem every day.
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).