Git
Submodules Commands
Include and manage external repositories within your project. Submodules are essential for large projects with shared libraries or when you need to pin specific versions of dependencies.
8 commands
Pro Tips
Use 'git clone --recurse-submodules' to clone a project with all its submodules in one command.
Run 'git submodule update --init --recursive' after pulling to ensure submodules are at the correct commits.
Consider Git subtree as an alternative - it's simpler for contributors who don't need to know about the submodule.
Common Mistakes
Submodules point to specific commits, not branches. You must explicitly update them to get new changes.
Forgetting to commit submodule changes after updating them is a common mistake - always check 'git status'.