From: Junio C Hamano <gitster@pobox.com>
To: Ben Knoble <ben.knoble@gmail.com>
Cc: "Michal Suchánek" <msuchanek@suse.de>,
"Jason Cho" <jason11choca@proton.me>,
"Jakub T. Jankiewicz" <jcubic@jcubic.pl>,
git@vger.kernel.org
Subject: Re: What is the reason behind not hiding git worktrees from git?
Date: Wed, 01 Oct 2025 11:54:04 -0700 [thread overview]
Message-ID: <xmqq3482312r.fsf@gitster.g> (raw)
In-Reply-To: <E311F5BA-F88C-4C3D-88B5-F8508B106D41@gmail.com> (Ben Knoble's message of "Wed, 1 Oct 2025 08:16:25 -0400")
Ben Knoble <ben.knoble@gmail.com> writes:
>> The impact is that the list of worktrees would have to be read to get
>> status. As status is not particularly cheap operation in any case I
>> would expect the problem to be minor.
>
> I believe status information is used for the shell prompt info, so
> performance hits there have a cost.
Sure, but an embedded git-controlled working tree _should_ be
flagged as an untracked entity, _unless_ it is ignore'd, no?
That is how you would add a new submodule to your project after all.
So, if you want to ignore them, just add them to .git/info/exclude
or something, perhaps?
Why do people even want to have such a layout, unless they want to
make it a submodule (or deliberate subdirectory that is unrelated)?
-+- README.md (your own branch, probably on main)
|
+-+ worktree-foo (worktree checkout of branch foo)
| |
| +-- README.md (a slight variant of the file in foo)
|
+-+ worktree-bar (worktree checkout of branch bar)
| |
| +-- README.md (a slight variant of the file in bar)
|
+-+ worktree-baz (worktree checkout of branch baz)
| |
| +-- README.md (a slight variant of the file in baz)
Wouldn't it be easier to manage if you had this instead?
-+
|
+-+ my-project (the primary worktree, probably on main)
| |
| +-- README.md (the file from branch main)
|
+-+ worktree-foo (worktree checkout of branch foo)
| |
| +-- README.md (a slight variant of the file in foo)
|
+-+ worktree-bar (worktree checkout of branch bar)
| |
| +-- README.md (a slight variant of the file in bar)
|
+-+ worktree-baz (worktree checkout of branch baz)
| |
| +-- README.md (a slight variant of the file in baz)
That way, you can go up to the umbrella directory and ...
$ cd ..
$ ls
my-project worktree-foo worktree-bar worktree-baz
$ grep -e HowTo */README.md
... do things you would do collectively to these worktrees with the
primary worktree included as well.
next prev parent reply other threads:[~2025-10-01 18:54 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-27 13:28 What is the reason behind not hiding git worktrees from git? Jakub T. Jankiewicz
2025-09-27 16:52 ` Junio C Hamano
2025-09-27 17:55 ` Michal Suchánek
2025-09-27 21:08 ` Jason Cho
2025-09-27 21:26 ` Jason Cho
2025-09-30 10:30 ` Michal Suchánek
2025-09-30 15:47 ` Junio C Hamano
2025-11-19 8:13 ` Michal Suchánek
2025-09-30 10:37 ` Michal Suchánek
2025-10-01 12:16 ` Ben Knoble
2025-10-01 18:54 ` Junio C Hamano [this message]
2025-10-01 20:22 ` Sergey Organov
2025-10-01 20:48 ` Junio C Hamano
2025-10-01 21:27 ` Jakub T. Jankiewicz
2025-10-01 22:07 ` Junio C Hamano
2025-10-01 21:29 ` Eric Sunshine
2025-10-01 22:27 ` Junio C Hamano
2025-10-02 8:38 ` Michal Suchánek
2025-10-02 13:33 ` Junio C Hamano
2025-10-02 15:51 ` [PATCH 1/2] doc: git-worktree: Link to examples Michal Suchanek
2025-10-02 17:42 ` Kristoffer Haugsbakk
2025-10-02 17:44 ` Junio C Hamano
2025-10-02 18:55 ` Michal Suchánek
2025-10-05 20:52 ` Jean-Noël AVILA
2025-10-10 17:10 ` Michal Suchánek
2025-10-10 17:04 ` [PATCH v2 " Michal Suchanek
2025-10-11 4:40 ` Eric Sunshine
2025-10-10 17:04 ` [PATCH v2 2/2] doc: git-worktree: Add side by side branch checkout example Michal Suchanek
2025-10-11 5:17 ` Eric Sunshine
2025-10-23 19:40 ` Junio C Hamano
2025-10-24 10:15 ` Michal Suchánek
2025-10-24 16:57 ` Eric Sunshine
2025-11-18 12:01 ` Michal Suchánek
2025-11-19 7:19 ` Eric Sunshine
2025-10-02 15:51 ` [PATCH " Michal Suchanek
2025-10-02 17:51 ` Kristoffer Haugsbakk
2025-10-02 18:46 ` Michal Suchánek
2025-10-02 18:47 ` Junio C Hamano
2025-10-02 18:06 ` Junio C Hamano
2025-10-02 18:39 ` Michal Suchánek
2025-11-17 22:36 ` What is the reason behind not hiding git worktrees from git? Johannes Schindelin
2025-11-17 22:57 ` Junio C Hamano
2025-10-02 2:33 ` Ben Knoble
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq3482312r.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=jason11choca@proton.me \
--cc=jcubic@jcubic.pl \
--cc=msuchanek@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).