Home Explore Blog CI



git

3rd chunk of `Documentation/git-clone.adoc`
83edb6df8a22637d6dc90eae4900a528c36450b4d29093620000000100000fa4
	protocol version 2.  The given string must not contain a NUL or LF
	character.  The server's handling of server options, including
	unknown ones, is server-specific.
	When multiple `--server-option=<option>` are given, they are all
	sent to the other side in the order listed on the command line.
	When no ++--server-option=++__<option>__ is given from the command
	line, the values of configuration variable `remote.<name>.serverOption`
	are used instead.

`-n`::
`--no-checkout`::
	No checkout of `HEAD` is performed after the clone is complete.

`--`[`no-`]`reject-shallow`::
	Fail if the source repository is a shallow repository.
	The `clone.rejectShallow` configuration variable can be used to
	specify the default.

`--bare`::
	Make a 'bare' Git repository.  That is, instead of
	creating _<directory>_ and placing the administrative
	files in `<directory>/.git`, make the _<directory>_
	itself the `$GIT_DIR`. This obviously implies the `--no-checkout`
	because there is nowhere to check out the working tree.
	Also the branch heads at the remote are copied directly
	to corresponding local branch heads, without mapping
	them to `refs/remotes/origin/`.  When this option is
	used, neither remote-tracking branches nor the related
	configuration variables are created.

`--sparse`::
	Employ a sparse-checkout, with only files in the toplevel
	directory initially being present.  The
	linkgit:git-sparse-checkout[1] command can be used to grow the
	working directory as needed.

`--filter=<filter-spec>`::
	Use the partial clone feature and request that the server sends
	a subset of reachable objects according to a given object filter.
	When using `--filter`, the supplied _<filter-spec>_ is used for
	the partial clone filter. For example, `--filter=blob:none` will
	filter out all blobs (file contents) until needed by Git. Also,
	`--filter=blob:limit=<size>` will filter out all blobs of size
	at least _<size>_. For more details on filter specifications, see
	the `--filter` option in linkgit:git-rev-list[1].

`--also-filter-submodules`::
	Also apply the partial clone filter to any submodules in the repository.
	Requires `--filter` and `--recurse-submodules`. This can be turned on by
	default by setting the `clone.filterSubmodules` config option.

`--mirror`::
	Set up a mirror of the source repository.  This implies `--bare`.
	Compared to `--bare`, `--mirror` not only maps local branches of the
	source to local branches of the target, it maps all refs (including
	remote-tracking branches, notes etc.) and sets up a refspec configuration such
	that all these refs are overwritten by a `git remote update` in the
	target repository.

`-o` _<name>_::
`--origin` _<name>_::
	Instead of using the remote name `origin` to keep track of the upstream
	repository, use _<name>_.  Overrides `clone.defaultRemoteName` from the
	config.

`-b` _<name>_::
`--branch` _<name>_::
	Instead of pointing the newly created `HEAD` to the branch pointed
	to by the cloned repository's `HEAD`, point to _<name>_ branch
	instead. In a non-bare repository, this is the branch that will
	be checked out.
	`--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
	via ssh, this specifies a non-default path for the command
	run on the other end.

`--template=<template-directory>`::
	Specify the directory from which templates will be used;
	(See the "TEMPLATE DIRECTORY" section of linkgit:git-init[1].)

`-c`

Title: Advanced Git Clone Options
Summary
The git clone command offers various advanced options to customize the cloning process, including options for sparse checkout, partial clones, filtering, mirroring, and more, allowing for fine-grained control over the cloning process and the resulting repository.