Submodules allow you to include other Git repositories within a Git repository and can be managed directly inside of GitKraken Desktop.
Adding submodules
Add a submodule by clicking the when hovering over Submodules in the left panel. Paste the HTTPS or SSH link to the repository, and then enter the path.
Adding a submodule to the repository adds a link to the submodule’s repository in the .gitmodules
file.
When the parent repository is cloned, it includes the reference to any submodules and the submodules require initialization.
Your repository tracks the submodule’s checked out commit. If there are any updates to the submodule, the files will not automatically update your working directory.
Updating submodules
To update submodules, navigate to the Submodule pane in the left panel and right click on the submodule.
If you clone a repository that contains a submodule, you will be prompted to initialize the submodule. This will clone the submodule’s repository and check out the referenced commit.
Changing pointer commit
To change the pointer commit, open the submodule in GitKraken Desktop and then check out the new commit. You may need to first create a branch on the target commit before you can check it out.
Then when you exit the submodule, GitKraken Desktop will detect the change and ask you if you wish to save the change.
Statuses
Below are possible statuses of your submodules and their remedies:
- Out of sync — The checked out commit of the submodule has changed. There is a change to the submodule reference in your work in progress that should be stashed, committed or discarded.
- Added but not initialized — Right click and select initialize.
- Added and initialized but not committed — When adding a submodule, commit the submodule folder to the repository and insert the reference to the submodule in the
.gitmodules
file.
Keep submodules up to date
There is a setting to automatically Keep submodules up to date when performing Git actions. This can be enabled or disabled:
- Globally – from Preferences > General
- Per repository – from Preferences > Submodules
GitKraken Desktop and subtree, not submodules
GitKraken Desktop does not currently support subtree in-app.