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

Re: [PATCH 1/3] checkout: provide hint when failing due to another worktree

From
Ben Knoble <ben.knoble@gmail.com>
Date
Sep 14, 2025, 19:06 UTC
Message-ID
<1A8DE1F7-6C83-4ACA-A9D4-D686787EA9BE@gmail.com>
In-Reply-To
<6B2DF1C9-8745-4733-8082-9C37BEF12150@gmail.com>
Show 48 quoted lines
> Le 14 sept. 2025 à 15:03, Ben Knoble <ben.knoble@gmail.com> a écrit :
> 
> 
>> Le 13 sept. 2025 à 16:56, Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com> a écrit :
>> 
>> Unrelated: I found it confusing that my `co = checkout` alias did not
>> work with this fresh-off-the-press Advice:[1]
>> 
>> ```
>> $ ./git co master
>> fatal: 'master' is already used by worktree at '<path>'
>> $ ./git checkout master
>> fatal: 'master' is already used by worktree at '<patch>'
>> hint: Use --detach to avoid this restriction,
>> hint: or --ignore-other-worktrees to ignore it.
>> hint: Disable this message with "git config set advice.branchUsedInOtherWorktree false"
>> ```
>> 
>> But it did for this older Advice (which is in my installed git(1)):
>> 
>> ```
>> $ ./git co -b .. @
>> fatal: '..' is not a valid branch name
>> hint: See `man git check-ref-format`
>> hint: Disable this message with "git config set advice.refSyntax false"
>> ```
>> 
>> It’s because aliases are run as a subprocess from the `git` in `PATH`:
>> 
>> ```
>> strvec_push(&cmd.args, "git");
>> ```
>> 
>> [1]: Chain of events:
>> 
>> 1. Try to trigger the Advice in this series
>> 2. ... but it doesn’t
>> 3. Is the code wrong?
>> 4. Wait, I’m using my alias (which I always use; I don’t think about it)
>> 5. I test with `git checkout`: it works
>> 6. ... so aliases don’t work with Advice?
>> 7. Test an existing Advice that I know about
>> 8. ... but it does work with aliases
>> 9.–15. ...
>> 
>> It was part of the process.  I didn’t *decide* to get hung up on it. ;)
> 
> Using bin-wrappers/git should set things up correctly, I think?
Ok, just saw the other patch series and see how this could not work. Thanks. 
Previous: Ben KnobleNext: Kristoffer Haugsbakk
Message 12 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.