I had cloned only one branch of a repo using
git clone -b mybranch --single-branch git://sub.domain.com/repo.git
as explained in Clone only one branch
Now I want to get the entire repo, including all the branches into that very location.
How do I do this?
When you use the --single-branch
option, you end up with a configuration for the named remote in .git/config
that looks something like this:
[remote "origin"]
url = https://github.com/project/repo.git
fetch = +refs/heads/some_branch:refs/remotes/origin/some_branch
You can edit the configuration to reset the fetch
configuration to the default:
git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
And then:
git remote update
And now you have the entire repository.