Subject: Re: New orphan worktree?

From: Junio C Hamano <[email-masked]>
Date: Tue, 23 Feb 2021 10:14:06 -0800

Ævar Arnfjörð Bjarmason <[email-masked]> writes:

>> I see where you're coming from in viewing --orphan as a modifier of
>> branch creation rather than as a branch-creation option itself.
>> However, as far as UI is concerned, that ship sailed a long time ago,
>> I suppose.
>
> Not really, I think we can have a new-style of it and just say:
>
>     It is also possible to provide `--orphan <branch-name>`, but
>     supplying it as an option to `-[cC]` as `-[cC] <branch-name>
>     --orphan` is preferred these days.
>
> Whether we should is another matter, see below...

We cannot affored to give it a short-and-sweet "-[oO]", but if we
could, we probably would have, and that would have made the UI
consistent, at least (in other words, I'd see the act of creating an
"orphan" branch something distinct from creation of a normal
branch).

"You can treat --orphan as a standalone and distinct request to
create this specific kind of branch, or you can treat as if it is
just a modifier to specify which kind of branch, and -c/-C is still
used to ask for creation or forced update" does not sound like a
very end-user friendly explanation, at least to me.  Extra choices
that do not make a real difference invites "so, which should I
use?", a question they do not have to ask.

>>> I think not having a -B or -C equivalent at all would be preferrable to
>>> having a --force special-case just to work around the lack of it for
>>> --orphan.
>>
>> I'm having trouble wrapping my brain around this statement.
>
> I mean I'd rather not have an --orphan mode that works like -B (as
> opposed to -b) at all instead of having one that's "--orphan
> --force-ref-deletion" or whatever.

If you are saying that we should just have

    -c/-b/--orphan
    -c/-b/--orphan --force
    -C/-B (synonym for -c/-b --force)

then I fully agree.  I think the uppercase ones (and "git branch -d/-D")
were mistakes and should have used --force instead.

> It's an obscure enough thing that I don't think anyone *really* cares. I
> just wanted to find out if it not being a boolean was intentional, or a
> historical accident we would consider fixing if there was further work
> on it.