Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to git clone all submodules (using --recursive) except one?

Tags:

git

clone

github

Is there a way to use git clone --recursive to clone a project including all of it's submodules, except one (manually specified) submodule? Thank you!

like image 422
Roel Van de Paar Avatar asked Sep 02 '25 16:09

Roel Van de Paar


1 Answers

git clone --recurse-submodules takes an optional pathspec. This pathspec can be negative (e.g., !*.c) to match all files but a particular path. See gitglossary(7) for the form of pathspecs. You may need to specify --recurse-submodules=. and the add an additional negative pathspec version as well.

like image 99
bk2204 Avatar answered Sep 05 '25 05:09

bk2204