Tower Help & Support

Working in a Submodule Folder

Since a Submodule is just a normal Git repsitory, you can of course work with it and make modifications like in any other repository.

Opening a Submodule in Tower

To open a Submodule repository in Tower, simply double-click it in the sidebar. Now you can make your changes just as usual.

When you're finished working in the Submodule, you can easily return to its parent repository since that is still part of the path in Tower's navigation bar.

Detached HEADs & Submodules

Usually, when working with Git, you have a certain branch checked out. However, Git also allows you to check out any arbitrary commit. Working in such a non-branch scenario is called having a "detached HEAD".

The reason this scenario deserves its own name is because it's both unusual and a little dangerous: when you make a commit in such a situation, that commit cannot be associated with a branch. Should you switch to a different branch afterwards, the commit will effectively be lost in space (and will be very hard to retrieve...).

Now here comes the connection to Submodules: using the "update" command on a Submodule checks out a specific commit - not a branch. This means that the Submodule repository will be in a "detached HEAD" state.

Don't Commit on a Detached HEAD
With all of this mind, a simple rule will help you when you need to work in a Submodule directly: be sure to create or check out a branch before committing your work!