Subject: Re: [PATCH v3 1/8] clone: teach --detach option

From: Junio C Hamano <[email-masked]>
Date: Fri, 28 Oct 2022 14:40:22 -0700

"Glen Choo via GitGitGadget" <[email-masked]> writes:

> From: Glen Choo <[email-masked]>
>
> Teach "git clone" the "--detach" option, which leaves the cloned repo in
> detached HEAD (like "git checkout --detach"). In addition, if the clone
> is not bare, do not create the local branch pointed to by the remote's
> HEAD symref (bare clones always copy all remote branches directly to
> local branches, so the branch is still created in the bare case).
>
> This is especially useful in the "submodule.propagateBranches" workflow,
> where local submodule branches are named after the superproject's
> branches, so it makes no sense to create a local branch named after the
> submodule's remote's branch.

Wouldn't it the same thing to do "git clone -n && git checkout
--detach"?  If this is a pure implementation detail of another
command and will never be used directly by end users, I am not
sure if we should add a new option to do this.

Especially because it is probably not hard to perform internally an
equivalent of "checkout --detach" without forking these days,
judging from the fact that merges and rebases need to do so.