How to convert a Git shallow clone to a full clone? How to convert a Git shallow clone to a full clone? git git

How to convert a Git shallow clone to a full clone?


The below command (git version 1.8.3) will convert the shallow clone to regular one

git fetch --unshallow

Then, to get access to all the branches on origin (thanks @Peter in the comments)

git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"git fetch origin


EDIT: git fetch --unshallow now is an option (thanks Jack O'Connor).

You can run git fetch --depth=1000000 (assuming the repository has less than one million commits).


I needed to deepen a repo only down to a particular commit.

After reading man git-fetch, I found out that one cannot specify a commit, but can specify a date:

git fetch --shallow-since=15/11/2012

For those who need incremental deepening, another man quote:

--deepen=<depth>

Similar to --depth, except it specifies the number of commits from the current shallow boundary instead of from the tip of each remote branch history.