git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 17:23 UTC

git submodule using worktrees?

From
Xavier Morel <xmo@odoo.com>
Date
Mar 12, 2026, 08:13 UTC
Message-ID
<5152ce98-b0ce-42f2-bd34-1cc324042f88@odoo.com>

I have a number of fairly large projects I work with, for that reason I have a bare clone for each and fork off worktrees as needed in order to avoid unnecessary duplication and pulls between them. That works just fine.

However when I tried to use submodules to provide a unified view of some of those projects I found out that there's seemingly no way to have submodules created as worktrees (off of a shared repository), at least not built-in. It seems like the submodules do set up some sort of bare repository / worktree situation but do not support passing in an existing repository to worktree off of.

`--reference` with `--dissociate` does avoid unnecessary fetches on the initial clone, but they do duplicate objects (and without `--dissociate` has all the issues of a non-static shared alternate), and do require duplicate fetches afterwards to update the submodules, even if the central local repository already has everything.

Q1: is there any way to massage the submodules into working off of a 
central shared repository? Poking around and messing with `.git/modules` 
didn't really work out but I may have just not poked the right bit, 
having to set up the submodules by hand (or via a bespoke script) is no 
issue.
Q2: is there any chance submodules will gain more first-class support 
for worktree-ing off of a local repository in the future
Next: Kristoffer Haugsbakk
Message 1 of 3 in “git submodule using worktrees?”
  1. Xavier MorelMar 12, 2026
  2. Kristoffer HaugsbakkMar 12, 2026
  3. Xavier MorelMar 12, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.