Re: New orphan worktree?

2 messages, 2 authors, 2021-02-23 · open the first message on its own page

Re: New orphan worktree?

From: Junio C Hamano <hidden>
Date: 2021-02-23 00:00:12

Eric Sunshine [off-list ref] 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.

Re: New orphan worktree?

From: Eric Sunshine <hidden>
Date: 2021-02-23 00:34:47

On Mon, Feb 22, 2021 at 6:59 PM Junio C Hamano [off-list ref] wrote:
Eric Sunshine [off-list ref] writes:
quoted
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`.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help