如何获取所有远程分支?

时间:2016-10-10 11:57:51

标签: git

不知何故,我的一个存储库拒绝获取新分支:

C:\temp>git fetch --all
Fetching origin

C:\temp>git branch -a
* develop
remotes/origin/develop

C:\temp>git ls-remote --heads origin
d130c97c1ccbe9ab35cd6e268c760781e37e3628 refs/heads/2.1.0.x
...
92685125df152fe053a2818de0c4d2ce8655c6b8 refs/heads/2.2.5.x
1e2eec16c7d63c84d6b53d0a221d22109b4de2a8 refs/heads/develop
f6447d5315fe777803b283bee7dac1dbdba92536 refs/heads/feature/0001089__icons_are_gone_-_move_inclusion_to_RC_files
e2cf0112b7e7fc18eb3467c7c42657208147efb2 refs/heads/feature/0001102__Debug_time_fix_exception_EIdSocketError_10060
6b2c89c6a39b3ce26cf42c5e8e5e0dd12c88abac refs/heads/feature/0001103__Research_cause_of_Internal_error_Stack_not_balanced
...
9f724b76b7c3533996fa03189e18a2f61fa5cf4f refs/heads/master
c233696172eb05522d1bb6705a3ea8cd730a762d refs/heads/origin/master
1db38f4fab2c41ee1931c9c6165aa6087556210a refs/heads/release
c233696172eb05522d1bb6705a3ea8cd730a762d refs/heads/trunk

如何强制git获取所有这些远程分支?

我在git version 2.8.2.windows.1

2 个答案:

答案 0 :(得分:13)

检查+refs/heads/*:refs/remotes/origin/* refspec

如果refspec是

,它只会获取所有分支
+refs/heads/develop:refs/remotes/origin/develop

如果refspec是:

fetch

然后develop只会带回Use GROUP BY with SUM() aggregate function. SELECT f.hmis, SUM(sa.number_of_computers), sa.service_area FROM facility_service_area sa, facility f WHERE f.hmis = sa.facility_hmis GROUP BY sa.service_area Also you can use INNER JOIN for this. SELECT f.hmis, SUM(sa.number_of_computers), sa.service_area FROM facility_service_area sa INNER JOIN facility f ON f.hmis = sa.facility_hmis GROUP BY sa.service_area 分支 这是典型的git clone --branch develop --single-branch

答案 1 :(得分:1)

您可以在终端机上检查分支机构cat .git/config

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
[remote "origin"]
    url = { git remote url }
    fetch = +refs/heads/develop:refs/remotes/origin
[branch "develop"]
    remote = origin
    merge = refs/heads/develop

git remote update,但不更新远程分支。 您将替换原点获取

首先,检查远程获取git config --get remote.origin.fetch

+refs/heads/develop:refs/remotes/origin/develop

秒,未设置远程提取使用git config --unset-all remote.origin.fetch 并添加另一个git config --add remote.origin.fetch +refs/heads/\*:refs/remotes/origin/feature/\*

然后,您可以检查替换远程git config --get remote.origin.fetch

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