Manage submodules
A submodule is another repository pinned inside yours at a specific commit. GitTree lists them with their state (not initialised, up to date, different commit, conflicted) and adds, initialises, updates, opens, edits and removes them.
Works in GitTree Free: every local Git feature, once you are signed in.
On this page
Before you start
- A repository with submodules (a
.gitmodulesfile), or one you want to add a submodule to.
Where to find it
- The Submodules section of the left panel; right-click a submodule for its actions.
- The command palette: Add Submodule… and Update All Submodules.
| Action | macOS | Windows and Linux |
|---|---|---|
| The command palette | ⌘⇧P | Ctrl+Shift+P |
Steps
See their state
Expand Submodules. Each shows not initialised, up to date, different commit or conflicted.
Initialise and update
After cloning, choose Initialise Submodule and Update Submodule, or Update All Submodules for every one. They are checked out at the commit your repository records.
Work inside one
Choose Open Submodule in a New Tab to commit, branch and push in it like any repository.
Add one
Run Add Submodule…: type the Repository URL, the Path in this repository, and optionally the Branch to follow. Then commit the new submodule and
.gitmodules.
Expected result
Your submodules are checked out at the right commits, and changes to them are committed in your repository like any file.
Edit, sync or remove
- Edit Submodule… changes its URL or branch; commit
.gitmodulesto share it. - Sync Submodule URL copies a changed URL from
.gitmodulesinto your configuration. - Remove Submodule… removes it; its history is kept in
.git/modules.
If something goes wrong
A submodule shows different commit
Its checkout differs from the commit your repository records. Update Submodule checks out the recorded one; or commit the new commit if you moved it on purpose.
Questions
Are submodules included in an exported archive?
No. Their folders are left out of archives (export an archive).