Save waiting-time/bandwidth and disk-space with

Do you have several project repos where you have JUCE and other libraries as git submodules in each of them?
When you clone your projects on a new computer, does cloning with all the submodules take forever?
So here’s something that could be useful for you - builds on git’s relatively new --reference feature to only clone a submodule once, and have its other instances reference the same git objects, saving precious download time and disk space!

It requires a relatively new git version that supports --reference (feature is new from last year, macOS’s system git already has it).

Cheers, Yair


You can also use:
git clone --recursive --depth=1 <git-url>
which will fetch only the code and last commit for the repo and its submodules.

1 Like

True, but over time as you update the submodules to new versions, the downloaded updates will still be duplicated unless using --reference.

I could add the --depth option to though to enjoy using both options.

Have now added an option to the script to do --depth 1, so that now you do both together.

1 Like