⚡ Advanced
How to use Git submodules
Include and manage external repositories inside your repository.
Add a submodule
git submodule add https://github.com/user/repo.git path/to/submoduleAdds an external repository as a submodule at the specified path.
Clone repo with submodules
git clone --recurse-submodules https://github.com/user/repo.gitClones the repo and automatically initializes and updates all submodules.
When to use: Cloning a project that uses submodules.
Initialize submodules after cloning
git submodule update --init --recursiveInitializes and updates all submodules after a plain clone.
When to use: If you cloned without --recurse-submodules.
Update all submodules
git submodule update --remoteFetches and updates all submodules to their latest remote commits.