远程分支未显示在"git branch -r"中.
我一直在推送到远程Bitbucket存储库,最近一位同事将他创建的新分支推送到了相同的存储库.
I have been pushing to a remote Bitbucket repository and recently a colleague has pushed a new branch he created to the same repository.
我正在尝试获取他上传的更改.
I'm trying to fetch the changes he uploaded.
$ git branch -a
* master
localbranch1
localbranch2
remotes/origin/master
$ git branch -r 来源/主人
$ git branch -r origin/master
在Bitbucket的Web UI中,我可以看到他创建的分支.我该怎么办?
In the web UI for Bitbucket I can see the branch he has made. How can I do this?
下次尝试:
$ git fetch bitbucket
Password for 'https://xxxxx@bitbucket.org':
From https://bitbucket.org/user/repo
* branch HEAD -> FETCH_HEAD
如果他创建的分支称为 new_branch_b ,我应该期望看到以下内容吗?
If the branch he created is called new_branch_b should I be expecting to see the following?
$ git branch -r
origin/master
origin/new_branch_b
第三次尝试:
$ git remote update
Fetching bitbucket
Password for 'https://xxxxx@bitbucket.org':
From https://bitbucket.org/user/repo
* branch HEAD -> FETCH_HEAD
$ git branch -r
origin/master
第四次尝试:
[remote "bitbucket"]
url = https://user@bitbucket.org/user/repo.git
我叫远程bitbucket
而不是起源(至少是我想起的;我之前设置过)
I called the remote bitbucket
rather than origin (at least that's what I recall; I set it up a while ago)
第五次尝试:
remote
部分还指定了获取规则.您可以在其中添加类似的内容,以从远程获取所有分支:
The remote
section also specifies fetch rules. You could add something like this into it to fetch all branches from the remote:
fetch = +refs/heads/*:refs/remotes/origin/*
(或将origin
替换为bitbucket
.)
请在此处阅读以下内容: 10.5 Git内部-Refspec
Please read about it here: 10.5 Git Internals - The Refspec