看不到远程分支 [英] Can't see remote branch

查看:89
本文介绍了看不到远程分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在学习git,不确定某些基本功能如何工作.我通过执行以下操作创建了本地分支机构:

I'm stil learning git and not sure how some basic things work. I created a local branch by doing:

git branch AppStore

我不记得我是如何将该分支推送到github.com的,但是我可以在存储库中看到MyBranch.

I can't remember exactly how I pushed this branch to github.com, but I can see MyBranch on the repository. When I do

git branch -a

我看到了:

  ARC
* AppStore
  Refactoring
  Release3
  master
  remotes/origin/AppStore
  remotes/origin/HEAD -> origin/master

也列出了更多的遥控器.因此,在创建分支的计算机上,我看到了AppStore分支.但是,我的同事们都做不到.当我们尝试

There are more remotes listed as well. So from my computer where I created the branch, I see the AppStore branch. However, none of my coworkers can. When we tried a

git pull origin AppStore

它获取了更改.但是当我们尝试

It grabbed the changes. But when we tried

git checkout AppStore 
or
git checkout origin AppStore

我们无法做到.我们缺少什么?谢谢!

We were not able to. What are we missing? Thanks!

我确实按照VonC的答案尝试了这一点:

I did try this according to VonC's answer:

git push --set-upstream origin AppStore

输入我的凭据后,我得到:

After putting in my credentials, I get:

Branch AppStore set up to track remote branch AppStore from origin.
Everything up-to-date

但是我的同事仍然看不到分支:-.

But my coworkers still cannot see the branch :-.

推荐答案

您需要在上游存储库中发布分支,同时在本地进行跟踪(确保本地分支与该新的远程分支保持同步:请参见"什么是跟踪分支)

You need to publish your branch on your upstream repo, while tracking it locally (making sure your local branch keep in synch with that new remote branch: see "What is a tracking branch")

git push --set-upstream origin AppStore


如评论中所述,其他开发人员需要获取已推送的内容(包括新分支).
git fetch起源是一种方法,但是如果您不确定远程仓库的名称,可以使用 git remote update 可以正常工作.


As mentioned in the comments, the other developers need to fetch what has been pushed (included the new branch).
A git fetch origin is one way, but if you are unsure of the name of the remote repo, a git remote update works just fine.

这将更新其远程分支,但不会创建具有相同名称的本地分支,如"

That will update their remote branches, but won't create a local branch of the same name, as detailed in "Track all remote git branches as local branches".

这篇关于看不到远程分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆