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

Re: New orphan worktree?

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Feb 23, 2021, 00:33 UTC
Message-ID
<CAPig+cQ5aLEzpUwFAkofd86HjJsJnJ-DtRKkrrkF0EdjHnJm4g@mail.gmail.com>
In-Reply-To
<xmqqmtvv64dp.fsf@gitster.g>
On Mon, Feb 22, 2021 at 6:59 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> Eric Sunshine <sunshine@sunshineco.com> writes:
> > When I was pondering the issue before writing my original response,
> > two thoughts came to mind. (1) "git worktree add --force --orphan
> > <branch>" would be one way to make your case work; (2) given how
> > infrequently --orphan is used, we just punt and require people to
> > first use "git branch -D <branch>" if necessary (which has been the
> > status-quo for git-branch and git-switch).
>
> FWIW, as I personally view that branch -d/-D, checkout -b/-B, and
> switch -c/-C were all mistakes (they should have been -d, -b and -c
> with and without --force, respectively), I find the combination of
> "--force --orphan" a reasonable way forward.

I'm also leaning toward `git worktree add --force --orphan <branch>` as a way forward. Indeed, `git worktree add --force -b <branch>` is a sensible extension even without --orphan being part of the equation, and it's easy to frame -B in documentation as equivalent to `--force -b`.

Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 12 of 22 in “New orphan worktree?”
  1. Stefan MonnierJan 6, 2021
  2. Jim HillJan 6, 2021
  3. Elijah NewrenJan 6, 2021
  4. Jim HillJan 6, 2021
  5. Elijah NewrenJan 6, 2021
  6. Eric SunshineJan 6, 2021
  7. Ævar Arnfjörð BjarmasonFeb 18, 2021
  8. Eric SunshineFeb 21, 2021
  9. Ævar Arnfjörð BjarmasonFeb 22, 2021
  10. Eric SunshineFeb 22, 2021
  11. Junio C HamanoFeb 22, 2021
  12. Eric SunshineFeb 23, 2021
  13. Ævar Arnfjörð BjarmasonFeb 23, 2021
  14. Eric SunshineFeb 23, 2021
  15. Ævar Arnfjörð BjarmasonFeb 23, 2021
  16. Junio C HamanoFeb 23, 2021
  17. Junio C HamanoJan 6, 2021
  18. Jim HillJan 6, 2021
  19. Junio C HamanoJan 6, 2021
  20. Jim HillJan 6, 2021
  21. Stefan MonnierJan 6, 2021
  22. Stefan MonnierJan 6, 2021

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.