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

The above command will fetch just the last commit from the remote repository.

Be aware that you may not be able to resolve merges in a shallow repository. It’s often a good idea to take at least as many commits are you are going to need to backtrack to resolve merges. For example, to instead get the last 50 commits:

git clone [repo_url] --depth 50

Later, if required, you can the fetch the rest of the repository:

git fetch --unshallow     # equivalent of git fetch -–depth=2147483647
                          # fetches the rest of the repository
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