Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to `git submodule add` a repo *without* cloning it?

Tags:

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?

like image 727
Jonathan Avatar asked Jan 02 '16 03:01

Jonathan


1 Answers

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).

like image 133
131 Avatar answered Sep 28 '22 06:09

131