I was working on my work computer the other day and set up a new branch in github. I made a local and remote branch.
Today I am working on my laptop at home and I don't see my branch that I made when I run "git branch".
How do I get access to this branch?
assuming you have this branch in your local repository, you can use git checkout <branchname>
to checkout a branch
If this branch is on the github repository but not in your local repository, you may want to git remote update
before git checkout <branchname>
and git pull
to fetch changes
What seems to have happened here, is that your local cache of the remote state is outdated. Before you can access these new branches you will need to refresh your local copy of the repository's state.
You can do this with:
git remote update
(see the earlier answer by Michael Ira Krufky ) git fetch [remotename]
Additionally when you run git pull
this automatically includes a git fetch
so that would also update your local copy
尝试git branch -a
来显示所有分支。
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.