Shallow Clone

suggest change

Cloning a huge repository (like a project with multiple years of history) might take a long time, or fail because of the amount of data to be transferred. In cases where you don’t need to have the full history available, you can do a shallow clone:

git clone [repo_url] --depth 1

That fetches only the tip commit of one branch. --depth implies --single-branch unless you also pass --no-single-branch.

Merges are harder to resolve in a shallow repository. Fetch at least as many commits as you need to walk back. For example, the last 50 commits:

git clone [repo_url] --depth 50

Later, if you need it, fetch the rest of the history:

git fetch --unshallow     # equivalent to git fetch --depth=2147483647
                          # fetches the rest of the history
git fetch --depth=1000    # fetch the last 1000 commits

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents