Git Submodule Support

The upcoming Orion 10 release includes support for Git submodules, providing features very similar to the ones offered in the Git command line. Git command line logic was used with the JGit plugin to integrate the features outlined below.

Adding a submodule

Submodule support allows the addition of new submodules to a repository. This can be a plugin you are using from a third party or any repository you would like to include in the project. We have added an add submodule button to the repository dropdown list. This will trigger a tooltip to provide the specified clone URL of the submodule you wish to add.

clonesub1

It is basically the same as git add submodule command in the command line, where you can specify the path to the submodule.

The cloned submodule, will appear nested in the tree view of the repository, present in both the editor and repository dropdown list. A .gitmodules file will also be generated in the repository.

Initializing a submodule

When cloning a submodule with nested submodules, the nested submodule’s contents will not be cloned and shown as an unknown repository in the repository dropdown. This is because it is uninitialized. Similarly to Git, submodules nested further than the first order will not be initialized.

Two new buttons, sync and update, have also been added to the repository dropdown menu, at the occurrence of a repository containing submodules. The sync and update functionality initializes and updates immediate submodules.

Commit and Push Changes

If a change is made in a submodule, the change needs to be pushed to the submodule and all higher level repositories containing it.

To push a change, a branch needs to be checked out, because the newly cloned submodule will be in Detached Head state, pointing to the latest commit. The changes can then be committed and pushed usual. These changes will now be reflected in the immediate parent, and can be committed and pushed. Similarly, for any other parents in the hierarchy.

**Note: There may be working directory changes reflected in parents other than the immediate parent of the changed submodule, but these cannot be committed until the changes are committed bottom up from the submodule.

**Note: You can also add submodules to submodules using the add submodule button for the submodule you wish to be the parent repository and commit the changes, as explained above.

Removing a submodule

There is now a trash icon beside every submodule indicating delete submodule.

sub1clone

Deleting a submodule will delete all content in the submodule as well as nested submodule repositories from the project.

Cloning a project with submodules

When cloning repositories, there is now a new feature in the more options popup, for recursive cloning of submodules. By default, this is set to true and will recursively clone all nested submodules. If unchecked, the repository will be cloned with its immediate submodules uninitialized. In the editor view, this will appear as empty folders. If you later want to clone the contents of the submodules, then they can be initialized with sync and update.

clone

For more information, visit the Detailed User Guide or Implementation Details.

This entry was posted in Announcements, New & Noteworthy. Bookmark the permalink.

1 Response to Git Submodule Support

  1. Pingback: Implementation Details – Git Submodule Support | Orion News

Comments are closed.