git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Gabriel Scherer <gabriel.scherer@inria.fr>, git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	"D. Ben Knoble" <ben.knoble@gmail.com>,
	Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH 0/3] extend --ignore-other-worktrees to 'rebase', add hints
Date: Mon, 15 Sep 2025 11:09:41 +0100	[thread overview]
Message-ID: <c7f9da8f-61ae-4ebe-b09e-a0c72f84a334@gmail.com> (raw)
In-Reply-To: <20250913141327.2775228-1-gabriel.scherer@inria.fr>

Hi Gabriel

On 13/09/2025 15:13, Gabriel Scherer wrote:
> The old 'workdir' contribution script was removed from git upstream in May
> 2025, as it is largely superseded by the 'worktree' command.
> 
> One significant difference between the old script and the command is that
> 'git' refuses to checkout or rebase branches that are already checked out in
> another worktree. My understanding of the reasoning is that users may be
> surprised when a clean worktree becomes dirty as its index is changed from
> another worktree. However, this safety net adds a mental burden to worktree
> users, as they have to keep the other worktrees in mind when moving
> branches. Old goats like me who are used to the old 'workdir' script find
> this restriction somewhat painful.
> 
> See the discussion thread
>    https://lore.kernel.org/git/5580aa89-09f1-426e-8483-c99481c998ab@gmail.com/
> about this transition.
> 
> The present patch series tries to provide a smoother migration path for
> supporters of worktree independence:
> 
>   - when 'checkout' refuses because the branch is used in another worktree,
>     display a 'hint' that mentions the possibility of using '--detach'
>     instead, and the '--ignore-other-worktrees' option to proceed anyway.

I think this is a good idea, though I agree with Junio that we want the 
hint to be a bit more explicit about where using --detach or 
--ignore-other-worktrees are appropriate.
>   - add support for '--ignore-other-worktrees' in 'rebase' as well, with
>     a similar hint.

I'm less convinced this is a good idea as the rebase command updates the 
branch which is going to be confusing if the branch is checked out 
elsewhere.

Thanks

Phillip
> In the future I would be interested in adding an option
> 'branch.ignoreOtherWorktrees' to be able to ignore other worktrees globally.
> 
> Note: this is my first experience submitting a patch to the Git project, so
> I apologize in advance for any mishap and welcome beginner-level feedback.
> 
> Cc: Junio C Hamano <gitster@pobox.com>
> Cc: D. Ben Knoble <ben.knoble@gmail.com>
> Cc: Phillip Wood <phillip.wood@dunelm.org.uk>
> 
> Signed-off-by: Gabriel Scherer <gabriel.scherer@inria.fr>
> 
> Gabriel.Scherer (3):
>    checkout: provide hint when failing due to another worktree
>    rebase: support --ignore-other-worktrees
>    rebase: hint when failing on branch used by another worktree
> 
>   Documentation/config/advice.adoc |  3 +++
>   Documentation/git-rebase.adoc    |  6 ++++++
>   advice.c                         |  1 +
>   advice.h                         |  1 +
>   branch.c                         | 13 +++++++++++--
>   branch.h                         |  4 ++++
>   builtin/checkout.c               | 12 ++++++++++--
>   builtin/rebase.c                 | 19 ++++++++++++++++++-
>   t/t3400-rebase.sh                |  4 +++-
>   9 files changed, 57 insertions(+), 6 deletions(-)
> 


      parent reply	other threads:[~2025-09-15 10:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-13 14:13 [PATCH 0/3] extend --ignore-other-worktrees to 'rebase', add hints Gabriel Scherer
2025-09-13 14:13 ` [PATCH 1/3] checkout: provide hint when failing due to another worktree Gabriel Scherer
2025-09-13 20:55   ` Kristoffer Haugsbakk
2025-09-14  7:50     ` Gabriel Scherer
2025-09-15  8:53       ` Junio C Hamano
2025-09-15 19:52         ` Gabriel Scherer
2025-09-16  5:32           ` Junio C Hamano
2025-09-17 14:17           ` Junio C Hamano
2025-09-17 15:25           ` Gabriel Scherer
2025-09-19 14:13             ` Phillip Wood
2025-09-14 19:03     ` Ben Knoble
2025-09-14 19:06       ` Ben Knoble
2025-09-14 19:32       ` Kristoffer Haugsbakk
2025-09-13 14:13 ` [PATCH 2/3] rebase: support --ignore-other-worktrees Gabriel Scherer
2025-09-15 10:09   ` Phillip Wood
2025-09-15 16:23     ` Junio C Hamano
2025-09-13 14:13 ` [PATCH 3/3] rebase: hint when failing on branch used by another worktree Gabriel Scherer
2025-09-13 19:30 ` [PATCH 0/3] extend --ignore-other-worktrees to 'rebase', add hints Ben Knoble
2025-09-13 20:02   ` Gabriel Scherer
2025-09-15 10:09 ` Phillip Wood [this message]

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=c7f9da8f-61ae-4ebe-b09e-a0c72f84a334@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=ben.knoble@gmail.com \
    --cc=gabriel.scherer@inria.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood@dunelm.org.uk \
    /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).