From: Eric Sunshine <sunshine@sunshineco.com>
To: Michal Suchanek <msuchanek@suse.de>
Cc: git@vger.kernel.org, "Jean-Noël AVILA" <avila.jn@gmail.com>,
"Junio C Hamano" <gitster@pobox.com>,
"Sergey Organov" <sorganov@gmail.com>,
"Ben Knoble" <ben.knoble@gmail.com>,
"Jason Cho" <jason11choca@proton.me>,
"Jakub T. Jankiewicz" <jcubic@jcubic.pl>
Subject: Re: [PATCH v2 2/2] doc: git-worktree: Add side by side branch checkout example
Date: Sat, 11 Oct 2025 01:17:47 -0400 [thread overview]
Message-ID: <CAPig+cSNesf0UwS4=Bxe-Qn+G9y3YYPyOK+7y3q8QJk+o7jaVg@mail.gmail.com> (raw)
In-Reply-To: <0e11e6fb394ffa3a1286deea5a8ede5ba3e4bdf4.1760115862.git.msuchanek@suse.de>
On Fri, Oct 10, 2025 at 1:05 PM Michal Suchanek <msuchanek@suse.de> wrote:
> doc: git-worktree: Add side by side branch checkout example
Thanks for taking my suggestion[*] regarding a possible git-worktree
documentation update and turning it into an actual patch. This is a
reasonable beginning, but I think it needs more work.
To begin, the idea was to document that worktrees can be used with
bare repositories, but neither the subject of this patch nor the prose
added to the documentation itself mentions bare worktrees. Instead,
they mention only "side by side branch checkouts", but I'm not even
sure what that means. I certainly wouldn't think of "bare repository"
when given the phrase "side by side branch checkouts", and I'm pretty
sure that phrase is not part of the existing Git lexicon, whereas
"bare repository" is, and is well known and well understood. So, I
think both the commit message and the prose added to the documentation
ought to mention "bare repository" instead.
Next, I think it is quite important that we spell out concretely in
prose that worktrees can be used with a bare repository. It is not
sufficient to merely infer it by giving an example, especially if the
reader is primarily reading the git-worktree.txt introductory material
which explains what worktrees are all about. So, for instance, we
could expand the "The new worktree is called..." introductory
paragraph to instead say something like this:
This new worktree is called a "linked worktree" as opposed to the
"main worktree" prepared by git-init(1) or git-clone(1). A
repository has one main worktree (if it’s not a bare repository)
and zero or more linked worktrees. Linked worktrees can also be
used with a bare repository, in which case there is no main
worktree but *only* linked worktrees (see EXAMPLES).
and also move the "When you are done with..." sentence from that
paragraph down to the "If a working tree is deleted..." paragraph,
which would become:
When you are done with a linked worktree, remove it with `git
worktree remove`. If a working tree is deleted without using `git
worktree remove`, then its associated administrative files, which
reside in the repository (see "DETAILS" below)...
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
> diff --git a/Documentation/git-worktree.adoc b/Documentation/git-worktree.adoc
> @@ -526,6 +526,16 @@ $ popd
> $ git worktree remove ../temp
> ------------
>
> +Side by side branch checkouts for a repository using multiple worktrees
> +
> +------------
> +mkdir some-repository
> +cd some-repository
> +git clone --bare gitforge@someforge.example.com:some-org/some-repository some-repository.git
> +git --git-dir=some-repository.git worktree add some-branch
> +git --git-dir=some-repository.git worktree add another-branch
> +------------
Several comments...
First, as mentioned above, rather than using the phrasing "side by
side branch checkouts", let's talk about this as being an example of
using worktrees with a bare repository.
Second, for consistency, let's follow the lead of the existing example
in git-worktree.txt and show the "$" shell prompt preceding the
commands. For instance:
$ mkdir ...
$ git clone ...
Third, the example seems overly complicated, especially with its use
of `--git-dir`, which feels less discoverable (at least to me) than,
say `-C`. What I have in mind is an example more like this:
$ git clone --bare <repository-url> myproj.git
$ git -C myproj.git worktree add feature-a
$ git -C myproj.git worktree add feature-b
That should be more than sufficient to get people up and running with
associating worktrees to a bare repository.
[*] https://lore.kernel.org/git/CAPig+cQgZijWi8VV1_QScKPhm9cqhQVvow4N-VH00R4oO1m2xA@mail.gmail.com/
next prev parent reply other threads:[~2025-10-11 5:18 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
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 [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPig+cSNesf0UwS4=Bxe-Qn+G9y3YYPyOK+7y3q8QJk+o7jaVg@mail.gmail.com' \
--to=sunshine@sunshineco.com \
--cc=avila.jn@gmail.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jason11choca@proton.me \
--cc=jcubic@jcubic.pl \
--cc=msuchanek@suse.de \
--cc=sorganov@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).