Submodules
Manage nested Git repositories within your project.
What are Submodules?
Submodules allow you to include other Git repositories within your repository, keeping them as separate projects with their own history.
Common uses:
- Shared libraries or components
- Third-party dependencies
- Separating large projects into modules
Adding a Submodule
- Go to Repository > Submodules
- Click Add Submodule
- Enter the repository URL
- Choose the local path
- Click Add
Cloning with Submodules
When cloning a repository that contains submodules:
- Clone the repository normally
- Go to Repository > Submodules
- Click Initialize to download submodule contents
Updating Submodules
Update All
Click Update All to fetch latest commits for all submodules
Update Individual
- Right-click a submodule
- Select Update
Viewing Submodule Status
The Submodules panel shows:
- Current commit
- Whether updates are available
- Modified files within submodules
Making Changes in Submodules
- Open the submodule as a separate repository
- Make changes and commit
- Push changes to submodule's remote
- Return to parent repo and commit the submodule update
Removing a Submodule
- Right-click the submodule
- Select Remove
- Confirm deletion
WARNING
This will remove the submodule reference and optionally delete the files.
Common Issues
Submodule Not Initialized
If submodule folders are empty:
Go to Repository > Submodules > Initialize
Detached HEAD in Submodule
Submodules checkout specific commits, not branches. To work on a branch:
bash
cd path/to/submodule
git checkout main