diff --git a/documentation/content/en/articles/committers-guide/_index.adoc b/documentation/content/en/articles/committers-guide/_index.adoc --- a/documentation/content/en/articles/committers-guide/_index.adoc +++ b/documentation/content/en/articles/committers-guide/_index.adoc @@ -473,6 +473,38 @@ If you are interested in the history, but are working with only one branch and are short on space, you can also use --single-branch to only download the one branch (though some merge commits will not reference the merged-from branch which may be important for some users who are interested in detailed versions of history). +===== Partial Clone + +If you are limited in bandwidth and/or local disk space, Git offers the possibility to filter the objects it requests from the repository when cloning using the https://www.git-scm.com/docs/partial-clone[Partial Clone] feature. + +The only drawback is that when you ask for information it does not have locally, Git will have to download the missing data, which it'll store locally, so you don't download something twice. +The download is done under hood and you don't see it happening, the only thing you'll see is the command being a bit longer to return. + +[NOTE] +====== +To explain what filtering is about, Git internally has three main kind of objects: + +* **blob**, which is used to store the content of a file. +* **tree**, which is a directory listing, it contains pointers to blobs, so the files in that directory, and other trees if it has sub directories. +* **commit**, which contain the actual commit, with author, date, message, and pointer to the root directorys tree, and parent commits. + +Filtering will limit the kind/number/size of objects you are downloading. +====== + +The most common filtering rules are + +* `--filter=tree:0` which will download all the commits, but no tree or blobs. +* `--filter=blob:none` which will download all the commits and all the trees, but no blobs. +* `--filter=blob:limit=[kmg]` which will download all the commits, all the trees, and only blobs that are smaller than the size limit. + +What will also be included are all the trees and blobs needed to checkout either the main branch or the branch that has been requested on the command line. +The full `--filter` arguments list can be found in the man:git-rev-list[1] man page. + +[source,shell] +.... +% git clone -o freebsd --filter=tree:0 $URL [dir] +.... + ===== Shallow Clone A shallow clone copies just the most current code, but none or little of the history.