Reputation: 801
I have a repository containing git submodules, such as pthread-win32. When I run git submodule update --recursive --init
on Linux, all submodules are updated unconditionally; even submodule pthread-win32
is cloned unnecessarily.
I would like to clone only submodules that are needed for any specific local platform.
Is there a way to tell git which submodules to update recursively based on some condition, such as the name of the local platform?
Upvotes: 1
Views: 653
Reputation: 1914
From man git submodule
, You can provide the path to a specific sub-module you want to update as an argument:
git submodule update --init --recursive path/to/submodule/dir/
If the modules are few number you can use the above command multiple times. Otherwise as a workaround you can put all the selected sub-modules into one directory and use a wildcard as follows-
git submodule update --init --recursive mylocalplatform/*
Upvotes: 3