0

A member of my team created a branch on GitHub.

On my computer i can

  • only see the master branch
  • and the branch that I myself had created.

How do I update my local git to show the other branches on the GitHub repository?

surfmuggle
  • 5,527
  • 7
  • 48
  • 77
  • After a `git pull`, the remote branches should be visible with `git branch -r`. – iBug Mar 23 '21 at 15:51
  • Does this answer your question? [How to fetch all Git branches](https://stackoverflow.com/questions/10312521/how-to-fetch-all-git-branches) – Gino Mempin Mar 24 '21 at 00:23

2 Answers2

1

First, you'd probably need to fetch to get fresh references from your remote repo.

Then, use git branch -r to have the full list of remote branches.

The listed references are only images of where these remote branches are pointing to at the moment you fetched, but be aware that :

  1. You won't be able to check them out as if they were local branches.

  2. They might change at any moment on the remote end, you local repo won't be notified of it. fetch each time you want to check for new branches/tags.

To check a branch out locally to work on it, just git checkout <branchname> without the <remotename>/ and git will automatically set the remote branch as the pull/push default destination for your local copy.

Romain Valeri
  • 19,645
  • 3
  • 36
  • 61
0

git fetch should to the trick.

joey
  • 227
  • 3
  • 18