Include other Git repositories in repositories.
Table of Contents
- Git Submodules to the Rescue
- Your First Submodule
- Update a Submodule
- Clone a Project with Submodules
Add a repository as a submodule
git submodule add <repo>Get the latest submodule repository updates
cd <path-to-submodule>git pullcd ..git statusgit commit -am "Update submodule to latest version"git pushgit clone <project-repo>cd <path-to-submodule>The submodule directory will be empty, so we need to initialize and update with contents
git submodule update -initShorthand would be:
git submodule update -igit clone --recursive <project-repo>git submodule foreach git pull origin master