Re: New orphan worktree?

2 messages, 2 authors, 2021-01-06 · open the first message on its own page

Re: New orphan worktree?

From: Junio C Hamano <hidden>
Date: 2021-01-06 21:29:50

Elijah Newren [off-list ref] 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".

Re: New orphan worktree?

From: Jim Hill <hidden>
Date: 2021-01-06 22:02:06

On Wed, Jan 6, 2021 at 1:32 PM Junio C Hamano [off-list ref] wrote:
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*]?
Git itself is an example of other reasons for carrying disjoint dags as a
set of related histories.

Also, I've taken to carrying submodule histories in the main repo, the setup is
very easy, just a submodule init and worktree add. I think the pair of flows
shows disjoint dags can be on a spectrum of relatedness.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help