git 如何第一次拉远程目录?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32246014/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I pull remote directory first time?
提问by Lali
I am asked to take clone of project repository from GitHub server.
我被要求从 GitHub 服务器克隆项目存储库。
There are three branches on server: master
, qa
and dev
.
服务器上有三个分支:master
、qa
和dev
。
After taking clone to the project, how can I checkout qa
or dev
branch as both the branches are not on my local machine?
克隆到项目后,由于两个分支都不在我的本地机器上,我如何检出qa
或dev
分支?
I tried the command
我试过命令
git checkout qa
it raised an error
它引发了一个错误
$ git checkout qa error: pathspec 'qa' did not match any file(s) known to git.
$ git checkout qa 错误:pathspec 'qa' 与 git 已知的任何文件都不匹配。
回答by Emons
Suppose your project is called SomeProject library and you need branches qa
and dev
besides default master
. Here's what you do:
假设您的项目名为 SomeProject 库,并且您需要分支qa
和dev
default master
。这是你要做的:
git clone https://github.com/someperson/someproject.git
cd someproject
git checkout -b qa origin/qa
gir checkout -b dev origin/dev
Now your local branches qa
and dev
track corresponding remote branches, and you can check them out:
现在你的本地分支qa
并dev
跟踪对应的远程分支,你可以查看它们:
git checkout qa
git checkout dev