diff options
| author | Junio C Hamano <gitster@pobox.com> | 2025-02-14 17:53:47 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-02-14 17:53:48 -0800 |
| commit | 5785d9143bcb3ef19452a83bc2e870ff3d5ed95a (patch) | |
| tree | 03d6edd344fee12ea80680126b49700202fa5816 /Documentation | |
| parent | Merge branch 'bc/doc-adoc-not-txt' (diff) | |
| parent | builtin/clone: teach git-clone(1) the --revision= option (diff) | |
| download | git-5785d9143bcb3ef19452a83bc2e870ff3d5ed95a.tar.gz git-5785d9143bcb3ef19452a83bc2e870ff3d5ed95a.zip | |
Merge branch 'tc/clone-single-revision'
"git clone" learned to make a shallow clone for a single commit
that is not necessarily be at the tip of any branch.
* tc/clone-single-revision:
builtin/clone: teach git-clone(1) the --revision= option
parse-options: introduce die_for_incompatible_opt2()
clone: introduce struct clone_opts in builtin/clone.c
clone: add tags refspec earlier to fetch refspec
clone: refactor wanted_peer_refs()
clone: make it possible to specify --tags
clone: cut down on global variables in clone.c
Diffstat (limited to 'Documentation')
| -rw-r--r-- | Documentation/git-clone.adoc | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/Documentation/git-clone.adoc b/Documentation/git-clone.adoc index db1c06560a..510b91b5c0 100644 --- a/Documentation/git-clone.adoc +++ b/Documentation/git-clone.adoc @@ -13,7 +13,7 @@ git clone [--template=<template-directory>] [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror] [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>] [--dissociate] [--separate-git-dir <git-dir>] - [--depth <depth>] [--[no-]single-branch] [--no-tags] + [--depth <depth>] [--[no-]single-branch] [--[no-]tags] [--recurse-submodules[=<pathspec>]] [--[no-]shallow-submodules] [--[no-]remote-submodules] [--jobs <n>] [--sparse] [--[no-]reject-shallow] [--filter=<filter-spec>] [--also-filter-submodules]] [--] <repository> @@ -221,6 +221,15 @@ 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. +`--revision=<rev>`:: + Create a new repository, and fetch the history leading to the given + revision _<rev>_ (and nothing else), without making any remote-tracking + branch, and without making any local branch, and detach `HEAD` to + _<rev>_. The argument can be a ref name (e.g. `refs/heads/main` or + `refs/tags/v1.0`) that peels down to a commit, or a hexadecimal object + name. + This option is incompatible with `--branch` and `--mirror`. + `-u` _<upload-pack>_:: `--upload-pack` _<upload-pack>_:: When given, and the repository to clone from is accessed @@ -273,12 +282,15 @@ corresponding `--mirror` and `--no-tags` options instead. branch when `--single-branch` clone was made, no remote-tracking branch is created. -`--no-tags`:: - Don't clone any tags, and set - `remote.<remote>.tagOpt=--no-tags` in the config, ensuring - that future `git pull` and `git fetch` operations won't follow - any tags. Subsequent explicit tag fetches will still work, - (see linkgit:git-fetch[1]). +`--[no-]tags`:: + Control whether or not tags will be cloned. When `--no-tags` is + given, the option will be become permanent by setting the + `remote.<remote>.tagOpt=--no-tags` configuration. This ensures that + future `git pull` and `git fetch` won't follow any tags. Subsequent + explicit tag fetches will still work (see linkgit:git-fetch[1]). + + By default, tags are cloned and passing `--tags` is thus typically a + no-op, unless it cancels out a previous `--no-tags`. + Can be used in conjunction with `--single-branch` to clone and maintain a branch with no references other than a single cloned |
