Re: What is the reason behind not hiding git worktrees from git?
- From
- Jakub T. Jankiewicz <jcubic@jcubic.pl>
- Date
- Oct 1, 2025, 21:27 UTC
- Message-ID
- <20251001232718.7218e852@jcubic>
- In-Reply-To
- <xmqqa52a1h6x.fsf@gitster.g>
On Wed, 01 Oct 2025 13:48:54 -0700 Junio C Hamano <gitster@pobox.com> wrote:
Show 16 quoted lines
> Sergey Organov <sorganov@gmail.com> writes: > > > Also, I'm almost sure that the first thing almost every worktree novice > > does (I did), quite naturally, is: > > > > $ git wotktree add <branch> > > > > that happily succeeds /anywhere/ inside primary worktree without any > > warning for me. It probably should either have created $top/../<branch> > > instead, or refuse to proceed without confirmation in the first place. > > Yeah, I almost never type 'git worktree add <directory>' without > "../" at the beginning of the directory, and every time I do so, I > do wonder if this is a UI pitfall that we should warn the users > about. Perhaps we should start from documentation updates and > possibly a new warning or two?
I discovered work trees recently, even that they are supported for years. And I though that the only way you use them is:
git worktree add branch
It just didn't occur to me, that you suppose to have them out outside the root directory. The way I think about git is:
directory/
.git
and all the stuff that belong that repoYou don't create submodules outside of your root directory. Didn't you?
-- Jakub T. Jankiewicz, Senior Front-End Developer https://jakub.jankiewicz.org https://lips.js.org https://koduj.org