A full clone of a large repository downloads every version of every file, which is wasteful for a CI job that builds one commit and slow for a developer who needs only the current tree. Git offers three ways to clone less, and one that copies everything. The behaviour below is Git 2.45; the related feature for working with part of the tree is in git sparse checkout.
Shallow: no history
git clone --depth 1 https://github.com/example/big-repo.git
git clone --depth 1 --single-branch --branch main https://github.com/example/big-repo.git
git -C big-repo log --onelinea1b2c3d (grafted, HEAD -> main, origin/main) Release 4.2
--depth 1 downloads the latest commit and its tree and nothing older. It is the fastest way to get source to build, and it is why CI systems default to it. The limits show quickly: git log stops at the graft, git blame attributes everything to that commit, and tools that look for tags or merge bases, such as git describe, cannot see them. A later git fetch --unshallow brings the full history, and --deepen 50 adds fifty more commits.
Partial: history without the bulk
git clone --filter=blob:none https://github.com/example/big-repo.git
git clone --filter=tree:0 --depth 1 https://github.com/example/big-repo.git--filter=blob:none downloads all commits and directory structure but no file contents, which Git fetches from the remote when a checkout, diff or blame needs them. History commands such as git log and git branch work offline in full, and the first checkout downloads only the files in the working tree. This is the better default for developers on large monorepos. blob:limit=1m skips only large files. tree:0 is lighter still, at the cost of slower history operations because trees are fetched on demand. The server must support filters, which GitHub, GitLab and Bitbucket do.
Mirror: copy everything
git clone --mirror git@old-host:team/project.git
cd project.git
git push --mirror git@new-host:team/project.git--mirror creates a bare repository with every branch, tag and other ref exactly as on the remote, and later git remote update refreshes it. It is meant for backups and migration between hosts. A mirror has no working tree and the push overwrites refs on the target, so do not use it to work or to push into a repository that has other activity. Hosting platforms may reject special refs, such as pull request refs, which show up as errors during the push.
Check what you got
git rev-parse --is-shallow-repository
git count-objects -vH
git config --get remote.origin.partialclonefilterThese tell you whether the clone is shallow, how large the object store is, and which filter was used. To make a shallow or partial clone complete later, use git fetch --unshallow and git fetch --refetch respectively; the second downloads again without the filter.
Where this does not apply
Shallow clones are poor for anything that needs history: release tooling that reads tags, changelog generators, blame, git bisect and merging branches. Partial clones need network access on demand, so they stumble offline once a missing file is needed, and tools that walk every blob, such as some secret scanners, trigger a download of all of them. In CI, --depth 1 plus fetch-depth: 0 only where tags are needed is a good compromise, see changed files in CI. Documentation is in the git clone manual and GitHub's partial and shallow clone guide.
For a daily workflow on a big repository, combining the filters is the usual answer: clone with --filter=blob:none --sparse, then choose directories as shown in git sparse checkout. Large binary assets belong in Git LFS, which keeps history small from the start. Measure the clone time and the size of .git before and after changing a pipeline, and keep the number, since it is the evidence that the change was worth making.



