my-git

Shallow Clone

English 中文

Shallow clone only fetches partial history.

Use for CI, temporary checks, and quickly downloading repositories. Avoid using it when complete historical analysis is required.

Basic Usage

Only pull the latest commit:

git clone --depth 1 <url>

Only pull shallow history for a specific branch:

git clone --depth 1 --branch main <url>

Suitable Scenarios

Unsuitable Scenarios

Converting to a Complete Repository

If full history is needed later:

git fetch --unshallow

Differences from Partial Clone

Shallow clone reduces history depth.

Partial clone reduces object downloads.

They solve different problems and can be used in combination, but verify support from your Git version and hosting platform.

Further Reading