I cloned a Git repository, which contains about five branches. However, when I do git branch I only see one of them:
$ git branch
* master
You can fetch all the branches by:
git fetch --all
or:
git fetch origin --depth=10000 $(git ls-remote -h -t origin)
The --depth=10000 parameter may help if you've shallowed repository.
To pull all the branches, use:
git pull --all
If above won't work, then precede the above command with:
git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'
as the remote.origin.fetch could support only a specific branch while fetching, especially when you cloned your repo with --single-branch. Check this by: git config remote.origin.fetch.
After that you should be able to checkout any branch.
See also:
To push all the branches to the remote, use:
git push --all
eventually --mirror to mirror all refs.
If your goal is to duplicate a repository, see: Duplicating a repository article at GitHub.