Blobless clone
git clone --filter=blob:none <url>
creates a blobless clone. These clones download all reachable commits and trees while fetching blobs on-demand. These clones are best for developers and build environments that span multiple builds.
Git downloads blobs on demand when you do a git checkout
. This includes the first checkout inside the git clone
operation.
blobless clones can perform commands like git merge-base
, git log
, or even git log -- <path>
with the same performance as a full clone.
Commands like git diff
or git blame <path>
require the contents of the paths to compute diffs, so these commands trigger blob downloads. However, the good news is that after the first run you have those blobs in your local repository and don’t need to download them again. Most developers only need to run git blame
on a small number of files, so this tradeoff of a slightly slower git blame
command is worth the faster clone and fetch times.
On the other hand, git log -p
without a path constraint is risky and could fetch all the blobs in history.