By admin , 29 April 2026

The filter language

Partial clone filters are specified by short DSL strings. Each filter excludes objects matching the spec from the transfer; missing objects are fetched on demand from the promisor remote.

Common filters

  • blob:none — omit all blobs.
  • blob:limit=<n>[kmg] — omit blobs larger than the threshold.
  • tree:<depth> — omit trees deeper than depth (0 means no trees, history-only).
  • sparse:oid=<blob> — use a sparse-checkout spec stored as a blob.
  • object:type=tag — exclude objects of a type (Git 2.36+).
  • combine:F1+F2+... — combine multiple filters with URL-encoding.

Examples

git clone --filter=blob:none url big-no-blobs
git clone --filter=blob:limit=10m url big-small-blobs
git clone --filter=tree:0 --no-checkout url history-only
git clone --filter=combine:blob:none+tree:0 url metadata-only

Choosing a filter

Use caseFilter
Daily development on a subsetblob:none + sparse-checkout
CI for a specific appblob:none + sparse-checkout cone
History analysis onlytree:0
Large media files separateblob:limit=10m
Read-only release deployblob:none + checkout one tag

Sparse filter

Pre-stage a sparse spec in the repo, then clone with it:

blob_oid=$(git hash-object .sparse)
git clone --filter=sparse:oid=$blob_oid url

Useful when many users share the same cone definition.

Combining

Combine filters by URL-encoding plus signs:

git clone --filter=combine:blob%3Anone+tree%3A0 url

Each filter applies independently; the union of excluded objects is omitted.

Verifying

git config --get remote.origin.partialclonefilter
git rev-list --missing=print HEAD | wc -l
du -sh .git/objects

Common mistakes

Using tree:0 for active development — every checkout fetches trees on demand, slowly. Forgetting that blob:limit is per blob, not aggregate. Combining filters with raw + instead of URL encoding fails parsing.

Server requirements

Server must enable uploadpack.allowFilter and the specific filter; some hosts restrict tree:0 due to its CPU cost. GitHub, GitLab, Gitea, Bitbucket, Forgejo all support standard filters.

Related

See "Partial clone: promise and promisor remotes" and "Sparse checkout for monorepos".