summaryrefslogtreecommitdiff
path: root/Documentation/git-clone.txt
diff options
context:
space:
mode:
authorGlen Choo <chooglen@google.com>2022-10-28 20:14:49 +0000
committerTaylor Blau <me@ttaylorr.com>2022-10-30 14:19:27 -0400
commitea42683e574f41516e2b7b628a899084722f7376 (patch)
tree66282e22b0e065b00c0e1c0664f98f08943a075c /Documentation/git-clone.txt
parent45c9f05c44b1cb6bd2d6cb95a22cf5e3d21d5b63 (diff)
downloadgit-ea42683e574f41516e2b7b628a899084722f7376.tar.gz
clone: teach --detach option
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@google.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 'Documentation/git-clone.txt')
-rw-r--r--Documentation/git-clone.txt8
1 files changed, 7 insertions, 1 deletions
diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
index d6434d262d..6a4e5d31b4 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.
+
-u <upload-pack>::
--upload-pack <upload-pack>::
When given, and the repository to clone from is accessed