diff --git a/book/02-git-basics/sections/getting-a-repository.asc b/book/02-git-basics/sections/getting-a-repository.asc index 3b69efd08..d71e93d60 100644 --- a/book/02-git-basics/sections/getting-a-repository.asc +++ b/book/02-git-basics/sections/getting-a-repository.asc @@ -82,6 +82,22 @@ $ git clone https://github.com/libgit2/libgit2 mylibgit That command does the same thing as the previous one, but the target directory is called `mylibgit`. +[NOTE] +.Partial and shallow clone +==== +Git version 2.22 and later introduce the `--filter` option to `git clone`, which creates a _partial clone_. +Beside that, you can also get a _shallow clone_ by specifying the `--depth` option. + +Partial and shallow clones can be useful in some situations, like when you're cloning an extremely large repository or cloning over a metered connection. +The benefit of doing a partial or shallow clone is that the clone takes up less size on disk. +The drawback is that a partial or shallow clone breaks the normal behavior of Git. + +If you don't want to deal with this complexity, just do a normal (full) clone (`git clone` without `--filter` or `--depth` options). + +We won't discuss partial and shallow clones in depth here, as these clones are for advanced users. +Please see the https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/[GitHub blog post about getting up to speed with partial clone and shallow clone^] and the https://docs.gitlab.com/ee/topics/git/partial_clone.html[GitLab documentation about partial clone^] for more information. +==== + Git has a number of different transfer protocols you can use. The previous example uses the `https://` protocol, but you may also see `git://` or `user@server:path/to/repo.git`, which uses the SSH transfer protocol. <> will introduce all of the available options the server can set up to access your Git repository and the pros and cons of each.