Subject: Re: New orphan worktree?

From: Junio C Hamano <[email-masked]>
Date: Wed, 06 Jan 2021 13:29:06 -0800

Elijah Newren <[email-masked]> writes:

> Sidenote:
>
> Yeah, checkout --orphan is broken.  You should use switch --orphan,
> which doesn't require the extra 'git rm -rf .' step.  That bit is
> definitely cumbersome.

I doubt "broken" is an appropriate word.  

It only targets a different workflow that wanted to start an
unrelated history with a known contents.

> Out of curiosity, why are you frequently creating orphan branches?
> Such an option would drop the number of commands you need to run from
> four down to two, but I'm surprised this would come up enough to
> matter enough to do much more than create a personal git alias for it.

Yes, a need to have multiple unrelated line of histories in a single
repository may not be there, even though a desire to do so might
exist.  What is done with these unrelated histories that record
unrelated contents [*1*]?

For example, the answer might turn out to be "our hosting provider
charge by number of publishing repositories, so I keep only one
repository there and push unrelated stuff into it, on different
branches", and such a use case to work around external limitation
can be more naturally solved by having separate repositories on the
producing side, and pushing into different branches in that single
publishing repository, which does not require any "--orphan" at all.

[Footnote]

*1* if the trees in these unrelated histories record related
    contents, the user wouldn't be doing "git rm -f ." in the first
    place and "checkout --orphan" would be more appropriate than
    "switch --orphan".