From: Junio C Hamano Date: Fri, 28 Oct 2022 21:40:22 GMT Subject: Re: [PATCH v3 1/8] clone: teach --detach option Message-ID: In-Reply-To: <432bc7cb3a42cf39d0033701c2cc677c9109b3dd.1666988096.git.gitgitgadget@gmail.com> "Glen Choo via GitGitGadget" writes: > From: Glen Choo > > 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.