git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/3] extend --ignore-other-worktrees to 'rebase', add hints

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Sep 15, 2025, 10:09 UTC
Message-ID
<c7f9da8f-61ae-4ebe-b09e-a0c72f84a334@gmail.com>
In-Reply-To
<20250913141327.2775228-1-gabriel.scherer@inria.fr>
Hi Gabriel
On 13/09/2025 15:13, Gabriel Scherer wrote:
Show 22 quoted lines
> 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
Show 28 quoted lines
> 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(-)
> 
Previous: Gabriel Scherer
Message 20 of 20 in “extend --ignore-other-worktrees to 'rebase', add hints”
  1. 0/3 extend --ignore-other-worktrees to 'rebase', add hintsGabriel Scherer, Sep 13, 2025
  2. 1/3 checkout: provide hint when failing due to another worktreeGabriel Scherer, Sep 13, 2025
  3. Kristoffer HaugsbakkSep 13, 2025
  4. Gabriel SchererSep 14, 2025
  5. Junio C HamanoSep 15, 2025
  6. Gabriel SchererSep 15, 2025
  7. Junio C HamanoSep 16, 2025
  8. Junio C HamanoSep 17, 2025
  9. Gabriel SchererSep 17, 2025
  10. Phillip WoodSep 19, 2025
  11. Ben KnobleSep 14, 2025
  12. Ben KnobleSep 14, 2025
  13. Kristoffer HaugsbakkSep 14, 2025
  14. 2/3 rebase: support --ignore-other-worktreesGabriel Scherer, Sep 13, 2025
  15. Phillip WoodSep 15, 2025
  16. Junio C HamanoSep 15, 2025
  17. 3/3 rebase: hint when failing on branch used by another worktreeGabriel Scherer, Sep 13, 2025
  18. Ben KnobleSep 13, 2025
  19. Gabriel SchererSep 13, 2025
  20. Phillip WoodSep 15, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.