I cloned a remote branch. How do I checkout master?

Viewed 167

I cloned a remote branch with git clone --single-branch --branch <branchname> <remote-repo> . Now I want to checkout master. When I try git checkout master I get this error message: error: pathspec 'master' did not match any file(s) known to git. How do I checkout master without having to clone it separately?

1 Answers

From the doc :

"Further fetches into the resulting repository will only update the remote-tracking branch for the branch this option was used for the initial cloning."

You'll have to reclone without the option I'm afraid.

Note that remote-tracking branches are not local branches. Recloning won't create a local branch for each remote one, even without --single-branch

Related