Git Reference / Submodules & sparse
17Submodules, sparse checkout & LFS
Submodules
Embed another repo at a pinned commit.
git submodule add https://github.com/lib/x libs/x git clone --recurse-submodules <url> git submodule update --init --recursive git submodule update --remote
Sparse checkout
Only materialize the folders you need in a huge monorepo.
git clone --filter=blob:none --sparse <url> git sparse-checkout set apps/web packages/ui git sparse-checkout add docs git sparse-checkout disable
Large File Storage
Keep big binaries out of the object database.
git lfs install git lfs track "*.psd" git add .gitattributes git lfs ls-files
Speed up big repos
Background maintenance and filesystem monitoring.
git maintenance start git config core.fsmonitor true git gc --aggressive