I have cloned a project and customized it. the project is using some extra projects as submodules. I have setup mine git repository and push the main project there. but I d
I don't think there is such a way with git. However, you could just do a shell script that iterates your list and calls git submodule add
on each of them, one by one.
Why just copying them to .gitmodules or to .git/index won't do the trick:
The "git submodule add" command does a couple of things:
- It clones the submodule under the current directory and by default checks out the master branch.
- It adds the submodule's clone path to the ".gitmodules" file and adds this file to the index, ready to be committed.
- It adds the submodule's current commit ID to the index, ready to be committed.
(source)
So you would be missing the last step, and git submodule init/update expect the commit id to be already in place. That is why you need git submodule add
.