从GIT克隆一个分支

时间:2014-11-25 17:19:58

标签: git openstack

我想从git存储库中查看OpenStack Neutron的分支JUNO。这样做的正确URI是什么?如果我做

% git clone git://github.com/openstack/neutron/tree/stable/juno/

它说:

openstack/neutron/tree/stable/juno is not a valid repository name

但我确实在https://github.com/openstack/neutron/tree/stable/juno/看到了这个分支。 我究竟做错了什么?感谢。

1 个答案:

答案 0 :(得分:5)

您没有克隆分支,而是克隆整个项目:

$ git clone git://github.com/openstack/neutron
Cloning into 'neutron'...
remote: Counting objects: 105856, done.
remote: Total 105856 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (105856/105856), 44.17 MiB | 1.06 MiB/s, done.
Resolving deltas: 100% (68444/68444), done.

完成后,您只需查看您感兴趣的分支机构。例如:

$ git checkout -b juno -t origin/stable/juno
Branch juno set up to track remote branch stable/juno from origin.
Switched to a new branch 'juno'