public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Xavier Morel <xmo@odoo•com>
To: git@vger•kernel.org
Subject: git submodule using worktrees?
Date: Thu, 12 Mar 2026 09:13:12 +0100	[thread overview]
Message-ID: <5152ce98-b0ce-42f2-bd34-1cc324042f88@odoo.com> (raw)

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

             reply	other threads:[~2026-03-12  8:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12  8:13 Xavier Morel [this message]
2026-03-12  8:20 ` git submodule using worktrees? Kristoffer Haugsbakk
2026-03-12  8:29   ` Xavier Morel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5152ce98-b0ce-42f2-bd34-1cc324042f88@odoo.com \
    --to=xmo@odoo$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox