Follow-up of this so-question: if I have a shallow clone, how to fetch all older commits to make it a full clone?
-
4Do you consider to mark @sdram's answer? That's the correct one. – Ionică Bizău Jul 13 '14 at 10:17
You can run git fetch --depth=1000000 (assuming the repository has less than one million commits).
-
178Now that
git fetch --unshallowexists (as in @sdram's answer), this answer is no longer the best one. – Jack O'Connor Apr 14 '14 at 8:41 -
1@sdram's answer did not work for me (git version 2.1.1), but this answer did. – kay Nov 7 '14 at 14:48
-
2Neither answer worked for me. Both commands succeeded in fetching all the missing commits, but when I try to push new commits, I get an error about the server not knowing about 'shallow' refs – Tyguy7 Sep 19 '15 at 0:08
-
2
git fetch --depth=2147483647is the largest possible depth to provide to the command. – clacke Apr 27 '17 at 5:47 -
3
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
-
30This doesn't undo the --single-branch side effect. To do that, edit .git/config and change fetch = +refs/heads/BRANCHNAME:refs/remotes/origin/BRANCHNAME to fetch = +refs/heads/*:refs/remotes/origin/* – Peter Cordes Jul 29 '14 at 21:36
-
3This doesn't create local branches tracking the remote branches, so you still need to checkout -b BRNAME origin/BRNAME to get that set up. – Peter Cordes Jul 29 '14 at 21:45
-
23See also stackoverflow.com/questions/17714159/…:
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*";git fetch originfrom an answer there should be the same as editting .git/config by hand – Peter Cordes Dec 8 '14 at 23:50 -
This only works if the repo is marked as shallow. I can't remember how, but there are situations where you can end up with an incomplete repo without having explicitly done a shallow clone. @svick's stackoverflow.com/a/6802238/260122 is the answer that works every time. – clacke Apr 27 '17 at 5:45
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.
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