Re: Selectively clone Git submodules -- a useful feature?
- From
Jens Lehmann <jens.lehmann@web.de>
- Date
- Jun 19, 2015, 19:08 UTC
- Message-ID
- <558468B2.2010307@web.de>
- In-Reply-To
- <162A5ADF-1FDD-432B-B5F8-672DF5B50EEC@gmail.com>
Am 18.06.2015 um 22:55 schrieb Lars Schneider:
Show 9 quoted lines
> AFAIK Git has two ways to clone a repository with respect to submodules: > > (1) Plain clone of just the repository itself: > git clone git://github.com/foo/bar.git > > (2) Recursive clone of the repository including all its submodules: > git clone --recursive git://github.com/foo/bar.git > > I am working on a big cross platform project and on certain platforms I don't
> need certain submodules. AFAIK there is no way to selectively clone only a > subset of the submodules with the standard command line interface. I wonder
> if something like an exclude pattern for submodules would be of general interest.
> I imagine a call like this after a plain "clone" operation:
> > git submodule update --init --recursive --exclude 3rdParty/Windows/*
Git already supports that use case: Just set the "submodule.<name>.update" configuration to "none" for all submodules you aren't interested in and "git submodule update" will always skip them.
You can also set this config option globally:
git config --global submodule.<name>.update=none
That'll set the default for all repositories of the logged in user on this computer to not update submodule <name>.
> or even: > > git clone --recursive --exclude 3rdParty/Windows/* git://github.com/foo/bar.git
git clone will be influenced by the global setting. If you just want to skip submodule <name> for a single clone you can do it like this:
git -c submodule.<name>.update=none clone --recursive git://github.com/foo/bar.git