简体   繁体   中英

How to update local branches from remote branches

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?

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.

git fetch should to the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM