From: Philippe Blain Date: Tue, 08 Nov 2022 13:32:07 GMT Subject: Re: [PATCH v3 1/8] clone: teach --detach option Message-ID: <6b17b06e-8217-ce56-0733-5501d81fe433@gmail.com> In-Reply-To: <432bc7cb3a42cf39d0033701c2cc677c9109b3dd.1666988096.git.gitgitgadget@gmail.com> Hi Glen, Le 2022-10-28 à 16:14, Glen Choo via GitGitGadget a écrit : > 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. > > Signed-off-by: Glen Choo > --- > Documentation/git-clone.txt | 8 +++++++- > builtin/clone.c | 12 +++++++++--- > t/t5601-clone.sh | 22 ++++++++++++++++++++++ > 3 files changed, 38 insertions(+), 4 deletions(-) > > diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt > index d6434d262d6..6a4e5d31b46 100644 > --- a/Documentation/git-clone.txt > +++ b/Documentation/git-clone.txt > @@ -16,7 +16,7 @@ SYNOPSIS > [--depth ] [--[no-]single-branch] [--no-tags] > [--recurse-submodules[=]] [--[no-]shallow-submodules] > [--[no-]remote-submodules] [--jobs ] [--sparse] [--[no-]reject-shallow] > - [--filter= [--also-filter-submodules]] [--] > + [--filter= [--also-filter-submodules] [--detach]] [--] > [] > > DESCRIPTION > @@ -210,6 +210,12 @@ objects from the source repository into a pack in the cloned repository. > `--branch` can also take tags and detaches the HEAD at that commit > in the resulting repository. > > +--detach:: > + If the cloned repository's HEAD points to a branch, point the newly > + created HEAD to the branch's commit instead of the branch itself. > + Additionally, in a non-bare repository, the corresponding local branch > + will not be created. > + "point the newly created HEAD to the branch's tip commit" would be slightly clearer, I think.