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

Git synthetic worktree

From
JTJimmy Thrasibule <jimmy.thrasibule@gmail.com>
Date
Aug 12, 2025, 07:56 UTC
Message-ID
<CAMqSRmCj-wcra=HE1=kv1LQU3UxhBg6zfbtO_OhWwJEqdf8gmw@mail.gmail.com>
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.

There may be multiple uses cases such as vendoring where a child project constructs a synthetic worktree with all its dependencies. Another use case is to generate patches with a tool such as `Quilt <https://savannah.nongnu.org/projects/quilt>` where the ``patches`` folder is an independent repository.

For example:

``` PROJECT A ├ File A ├ File B └ README ```

``` PROJECT B ├ patches │ ├ File 1 │ └ File 2 └ README ```

``` SYNTHETIC ├ patches │ ├ File 1 │ └ File 2 ├ File A ├ File B └ README ```

To put it simply, I'd like to replicate `Overlay FS <https://docs.kernel.org/filesystems/overlayfs.html>` in Git.

Now what happens when we have the same file in the repositories? We can specify which repository is at the top of the stack.

The CLI experience could look like something like this:

``` $ git clone repoA $ git remote add repoB $ git worktree push repoB/main Usual git commands now applies to `repoB`. $ git worktree top repoA. Usual git commands now applies to `repoA`. $ git worktree pop repoB/main Files from `repoB` are gone. ```

Next: Antonio Russo
Message 1 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.