Convert a shallow cloned/pulled git repository to a normal one

Shallow clone/pull is very useful to speed up the clone process and save disk space and our time, but sometimes we may want to make a repository un-shallow in future. Re-clone/pull it all is not a good idea, in fact, git provides unshallow parameter since version 1.8.2.1

--unshallow

If the source repository is complete, convert a shallow repository to a complete one, removing all the limitations imposed by shallow repositories.

If the source repository is shallow, fetch as much as possible so that the current repository has the same history as the source repository.

https://git-scm.com/docs/git-fetch/

So next time, try git fetch --unshallow to make the repo be a normal, unshallow one, don’t just re-clone/pull.

發表迴響