Skip to content

Reference: Git Cloneλ︎

clone a repository from another location, typically a shared Git service (GitHub, GitLab, etc.)

git clone --origin practicalli repository-url local-directory

--branch option will checkout a specific branch name once cloned.

Clone - Git reference

Managing Clone sizeλ︎

Continuous Integration workflows can be more effective when cloning a small part of the repository.

Partial Cloneλ︎

--filter option is used to clone a partial repository.

git rev-list --filter=<filter> --all shows objects in your repository that match the filter.

Blobless clone
git clone --filter=blob:none <url>

Blobless clone downloads all reachable commits and trees, fetching blobs on-demand.

Use case: developers and build environments that span multiple builds.

Treeless clone
git clone --filter=tree:0 <url>
treeless clone download all reachable commits, fetching trees and blobs on-demand.

Use case: build environments where the repository will be deleted after a single build, where access to commit history is required

Shallow Cloneλ︎

A shallow clone truncate the commit history, only fetching after the specified time.

git clone --shallow-since=<date>

Use case: build environments where the repository will be deleted after a single build.

Shallow clones are discouraged for development as they limit git commands and may put undue stress on later fetches

Partial Clones are typically recommended over shallow clones

Get up to speed with partial clone and shallow clone