Nathan H
Nathan H

Reputation: 49371

git branch -a does not show all remote branches

My remote git server has 2 branches, develop and release.

I've cloned the repository, but when I do git branch -a I see:

* develop
  remotes/ghe/HEAD -> ghe/develop
  remotes/ghe/develop

I tried to do a git fetch but it did not update the list.

Upvotes: 3

Views: 3376

Answers (1)

Thomas Stringer
Thomas Stringer

Reputation: 5862

By running git clone with a --depth of 1, you're creating a shallow clone. The behavior you saw is the default behavior without specifying --no-single-branch to get the tips of all branches, instead of the most recent single branch. By not specifying this option, you're just getting the primary branch where the remote HEAD is pointing to.

If you wanted a shallow clone with the tips of all branches the solution would have been to specify the option --no-single-branch.

For more information, take a look at the documentation on git clone.

Upvotes: 5

Related Questions