我一直在推动远程bitbucket回购,最近一位同事将他创建的新分支推到了同一个回购中.
我正在尝试获取他上传的更改.
$ git branch -a
* master
localbranch1
localbranch2
remotes/origin/master
Run Code Online (Sandbox Code Playgroud)
$ git branch -r
origin/master
在用于bitbucket的web ui中,我可以看到他所创建的分支.任何帮助/建议/方向将是最受欢迎的.谢谢.
您需要的任何进一步信息.
编辑1
$ git fetch bitbucket
Password for 'https://xxxxx@bitbucket.org':
From https://bitbucket.org/user/repo
* branch HEAD -> FETCH_HEAD
Run Code Online (Sandbox Code Playgroud)
如果他创建的分支名为new_branch_b,我应该期待看到:
$ git branch -r
origin/master
origin/new_branch_b
Run Code Online (Sandbox Code Playgroud)
编辑2
$ 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
Run Code Online (Sandbox Code Playgroud)
编辑3
[remote "bitbucket"]
url = https://user@bitbucket.org/user/repo.git
Run Code Online (Sandbox Code Playgroud)
我打电话给远程bitbucket而不是原点(至少这是我记得的,我刚刚设置它)
编辑4
我按照kan的回答更新了bitbucket远程配置.
$ git config -e
[remote "bitbucket"]
url = https://user@bitbucket.org/user/repo.git
fetch = +refs/heads/*:refs/remotes/bitbucket/*
Run Code Online (Sandbox Code Playgroud)
对于大多数人来说,它将被称为原产地
[remote "origin"]
url = https://user@bitbucket.org/user/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
Run Code Online (Sandbox Code Playgroud)
然后
$ git remote update
Fetching bitbucket
Password for 'https://user@bitbucket.org':
remote: Counting objects: 48, done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 35 (delta 21), reused 0 (delta 0)
Unpacking objects: 100% (35/35), done.
From https://bitbucket.org/user/repo
* [new branch] branch_name1 -> origin/branch_name1
* [new branch] branch_name2 -> origin/branch_name2
Run Code Online (Sandbox Code Playgroud)
.... 等等.
我认为git fetch origin也适用git remote update
感谢所有帮助我解决这个问题的人.
Bru*_*uno 200
如果您还没有这样做,请更新您的遥控器:
$ git remote update
$ git branch -r
Run Code Online (Sandbox Code Playgroud)
kan*_*kan 100
该remote部分还指定了提取规则.你可以添加类似的东西:
fetch = +refs/heads/*:refs/remotes/origin/*
Run Code Online (Sandbox Code Playgroud)
从远程获取所有分支.(或替换origin通过bitbucket).
请在此处阅读:https://git-scm.com/book/en/v2/Git-Internals-The-Refspec
Don*_*lie 26
如果使用--depth参数进行克隆,则会将.git/config设置为不提取所有分支,而只设置为master.
您可以简单地省略参数或更新配置文件
fetch = +refs/heads/master:refs/remotes/origin/master
Run Code Online (Sandbox Code Playgroud)
至
fetch = +refs/heads/*:refs/remotes/origin/*
Run Code Online (Sandbox Code Playgroud)
jes*_*cah 18
我遇到过同样的问题.似乎最简单的解决方案是只删除遥控器,重新添加它,然后获取.
不幸的是git branch -a和git branch -r你不显示所有远程分支机构,如果你还没有执行的“混帐提取”。git remote show origin一直持续工作。还git show-ref显示git repo中的所有引用。但是它就像git branch命令一样工作
| 归档时间: |
|
| 查看次数: |
99864 次 |
| 最近记录: |