Partial Clone

Partial Clone: Fetching Trees Without Blobs

A partial clone downloads all commits but leaves out objects chosen by a filter, fetching them later when a command needs them. --filter=blob:none omits file contents, blob:limit=1m only big ones, and tree:0 omits trees too. The server must allow filters, so Sam enables them on the bare repository:

A blobless clone that fetches contents on demandShell
git -C ../server/booknest.git config set uploadpack.allowFilter true
git clone -q --filter=blob:none --no-checkout file://$PWD/../server/booknest.git ../partial
cd ../partial
git rev-list --objects --all --missing=print | grep -c "^?"
git checkout -q main
git rev-list --objects --all --missing=print | grep -c "^?"
git backfill
git rev-list --objects --all --missing=print | grep -c "^?"
cd ../booknest
Output
77
40
2

--missing=print marks absent objects with ?. The clone lacked all 77 blobs; checking out main fetched the 37 it needs (the smudge filter fetched the covers from the LFS server), and the experimental git backfill (Git 2.49 1,932 ) fetched the history of HEAD in batches, leaving 2 blobs used only by release/1.1. The remote is recorded as a promisor, so git log -p or git blame fetch missing blobs transparently, one round trip at a time. The file:// URL matters: a plain path clones with shortcuts that ignore filters. GitHub 29 and GitLab 377 allow filters; prefer blob:none for development and tree:0 for one-commit CI builds.