Git:无法看到新的远程分支 [英] Git: Cannot see new remote branch

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

问题描述



  $ 

一位同事将一个新的远程分支推送到/ dev / git分支-r

我仍然看到预先存在的远程分支。



我认为这是因为我的本地远程引用不是最新的,因此当我运行git pull时什么都没有发生,因为git pull只会引用当前工作分支正确?与git push不同的是,它推动所有对相应的远程分支有变化的分支?

首先,仔细检查分支是否已经实际上是通过使用命令 git ls-remote origin 远程推送的。如果新分支出现在输出中,请尝试命令 git fetch :它应该从远程存储库下载分支引用。



如果您的远程分支仍未出现,请仔细检查(在 ls-remote 输出中)远程分支名称是什么,具体而言,如果它以 refs / heads / 开头。这是因为,默认情况下, remote.< name> .fetch 的值为:

  + refs / heads / *:refs / remotes / origin / * 

这样只有名称以 refs / heads / 开头的远程引用才会被本地映射为远程跟踪引用,位于 refs / remotes / origin / (即,它们将成为远程追踪分行)

A colleague pushed a new remote branch to origin/dev/homepage and I cannot see it when I run:

$ git branch -r

I still see preexisting remote branches.

I assume this is because my local remote refs are not up-to-date hence when I ran a git pull nothing happened since git pull only pulls on the current working branch correct? Unlike git push which pushes all branches that have changes to the corresponding remote branch?

解决方案

First, double check that the branch has been actually pushed remotely, by using the command git ls-remote origin. If the new branch appears in the output, try and give the command git fetch: it should download the branch references from the remote repository.

If your remote branch still does not appear, double check (in the ls-remote output) what is the branch name on the remote and, specifically, if it begins with refs/heads/. This is because, by default, the value of remote.<name>.fetch is:

+refs/heads/*:refs/remotes/origin/*

so that only the remote references whose name starts with refs/heads/ will be mapped locally as remote-tracking references under refs/remotes/origin/ (i.e., they will become remote-tracking branches)

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

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