Hi Glen, Le 2022-10-28 à 16:14, Glen Choo via GitGitGadget a écrit : > From: Glen Choo <chooglen@xxxxxxxxxx> > > 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 <chooglen@xxxxxxxxxx> > --- > 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 <depth>] [--[no-]single-branch] [--no-tags] > [--recurse-submodules[=<pathspec>]] [--[no-]shallow-submodules] > [--[no-]remote-submodules] [--jobs <n>] [--sparse] [--[no-]reject-shallow] > - [--filter=<filter> [--also-filter-submodules]] [--] <repository> > + [--filter=<filter> [--also-filter-submodules] [--detach]] [--] <repository> > [<directory>] > > 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.