Re: What is the reason behind not hiding git worktrees from git?
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Nov 17, 2025, 22:36 UTC
- Message-ID
- <8cc4ca72-c87a-acc1-e200-53be14d649f8@gmx.de>
- In-Reply-To
- <CAPig+cQgZijWi8VV1_QScKPhm9cqhQVvow4N-VH00R4oO1m2xA@mail.gmail.com>
Hi Eric,
On Wed, 1 Oct 2025, Eric Sunshine wrote:
Show 16 quoted lines
> [...] There are plenty of people who already locate worktrees as > subdirectories of the main worktree[*] and do so without problem, and > for whom it is a preferred workflow, so I don't see why we would want to > penalize them by warning against doing so, especially since there is no > technical reason to avoid the practice (i.e. Git handles it just fine). > [...] > > FOOTNOTES > > [*]: There have been numerous emails on the list showing that placing > worktrees as subdirectories of the main worktree is common enough > practice. And, as far as "experienced users" are concerned (not just > novices picking up the practice from blogs or tutorials), I recall an > email discussion in which Dscho has said that he locates worktrees as > subdirectories of the main worktree, as well. I, too, have done so on > occasion.
And indeed I do, and continue to do so because the counter arguments in that email discussion looked quite weak to me.
In the one instance where I heeded that well-meant advice to create worktrees outside of my main worktree, I lost work when I had cleaned up that main worktree after verifying with `git status` that there was no unfinished business to take care of before deleting the repository. Because that secondary worktree (which did contain unfinished business, including a carefully crafted series of commits) was now obviously no longer a worktree but only a tree without a working `.git`.
Ciao, Johannes