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

耗尽温柔 提交于 2019-12-17 02:54:09

问题


Follow-up of this so-question: if I have a shallow clone, how to fetch all older commits to make it a full clone?


回答1:


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




回答2:


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



回答3:


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.




回答4:


You can try this:

git fetch --update-shallow



回答5:


None of the above messages did the trick. I'm trying to work with git tags starting from a shallow clone.

First I tried

git fetch --update-shallow

which kind of worked half-way through. Yet, no tags available!

git fetch --depth=1000000

This last command really fetched the tags and I could finally execute

git checkout -b master-v1.1.0 tags/v1.1.0

and be done with it.

HTH



来源:https://stackoverflow.com/questions/6802145/how-to-convert-a-git-shallow-clone-to-a-full-clone

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!