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

Re: GIT_DIR output from git worktree list

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Dec 13, 2020, 06:07 UTC
Message-ID
<CAPig+cRZ-018Krj2fGq0hx5qNptW8qUiwhkws8ixvk242Z_b0g@mail.gmail.com>
In-Reply-To
<CACsJy8Dq9Lz1YkkqvR0Fa1PLUBJhNJTmLtnRssi=DDpWAQTWww@mail.gmail.com>
On Wed, Dec 9, 2020 at 4:31 AM Duy Nguyen <pclouds@gmail.com> wrote:
Show 12 quoted lines
> On Wed, Dec 9, 2020 at 2:27 AM Eric Sunshine <sunshine@sunshineco.com> wrote:
> > What I was suggesting was that it might be the case that the only way
> > to solve this would be to store the location of the main worktree
> > somewhere within <repo> in some file, and then `git worktree list`
> > would consult that file to learn the location of the main worktree.
>
> Not that it matters because I don't do Git anymore. But when I was
> doing this I imagined unify main and secondary worktrees. When you
> switch from single to multiple worktrees, there is no main worktree
> anymore. The place that is main worktree still has your files, but it
> has the same status and treatment as any other worktree. And the repo
> is tucked away somewhere safe.

I had some vague thoughts along those lines, as well, but such a change is outside the scope of my limited time these days.

Superficially, the idea I expressed above, of storing the path of the main worktree in some file within the repository (let's say `.git/mainworktreepath`) doesn't seem like it should be too difficult (though I haven't really thought it through). And, if the main worktree does get moved, the file could be fixed up or kept up-to-date by the `git worktree repair` command.

(By the way, thanks for responding. It's nice to hear from you again after your long absence.)

Previous: Duy Nguyen
Message 9 of 9 in “GIT_DIR output from git worktree list”
  1. Gabriel NütziSep 29, 2020
  2. Eric SunshineSep 30, 2020
  3. Gabriel NütziSep 30, 2020
  4. Eric SunshineSep 30, 2020
  5. Eric SunshineDec 7, 2020
  6. Ganriel NütziDec 7, 2020
  7. Eric SunshineDec 8, 2020
  8. Duy NguyenDec 9, 2020
  9. Eric SunshineDec 13, 2020

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.