Skip to content
GitTree
Stashes and worktrees

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.

FreeUpdated

Works in GitTree Free: every local Git feature, once you are signed in.

On this page
  1. Before you start
  2. Where to find it
  3. Steps
  4. Expected result
  5. Edit, sync or remove
  6. If something goes wrong
  7. Questions
  8. Related

Before you start

  • A repository with submodules (a .gitmodules file), 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.
ActionmacOSWindows and Linux
The command palette⌘⇧PCtrl+Shift+P

Steps

  1. See their state

    Expand Submodules. Each shows not initialised, up to date, different commit or conflicted.

  2. 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.

  3. Work inside one

    Choose Open Submodule in a New Tab to commit, branch and push in it like any repository.

  4. 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 .gitmodules to share it.
  • Sync Submodule URL copies a changed URL from .gitmodules into 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).