git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git synthetic worktree

From
Antonio Russo <aerusso@aerusso.net>
Date
Aug 12, 2025, 13:40 UTC
Message-ID
<b6179ded-abbf-4c9a-95c4-903451f7bc71@aerusso.net>
In-Reply-To
<CAMqSRmCj-wcra=HE1=kv1LQU3UxhBg6zfbtO_OhWwJEqdf8gmw@mail.gmail.com>
On 2025-08-12 01:56, Jimmy Thrasibule wrote:
Show 5 quoted lines
> Hi,
> 
> I'd like to create a single worktree where files from multiple Git
> repositories (or refs) coexist side-by-side (no subfolder separation),
> but each with repository still independently tracked by Git.

I've accomplished something similar to this with a gitignore-everything policy and sparse checkout (non-cone mode, very important!).

It's janky: I use GIT_DIR and GIT_WORK_TREE to force the selection of which git repository, and I have to use 'git add -f' everywhere.

If you need something that works today, this may be a workaround. It does not allow for your "default override" based on layer priority, instead it is very file-by-file specific.

As an aside, what you are describing sounds somewhat like a use-case for ostree, which I know very little about.

Best, Antonio

Previous: Jimmy Thrasibule
Message 2 of 2 in “Git synthetic worktree”
  1. Jimmy ThrasibuleAug 12, 2025
  2. Antonio RussoAug 12, 2025

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.