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
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user