我正试图从Github的存储库中提取信息.但是我不想克隆master分支.我想克隆其他分支.当我尝试 git clone< url> 时,我从master分支获取了文件.我该怎么办?
I am trying to pull from a repository in Github. But I don't want to clone the master branch. I want to clone some other branch. When I try git clone <url>, I get the files from the master branch. What should I do?
此外,假设代码已在存储库中更新,并且我想获取最新代码,是否应该再次使用 git clone ?因为项目规模巨大.另外,如果我在本地对项目进行更改,然后再次使用git clone,我所做的更改还会存在吗?如果我不希望有更改该怎么办?
Also, suppose the code is updated in the repository and I want to get the latest code, should I again use git clone ? Because the size of the project is huge. Also if I make changes to the project locally, and then I again use git clone, will the changes I made still be there? What if I don't want changes to be there?
我什至不确定 git clone 是正确的命令. git pull 或 git fetch ?
I am not even sure if git clone is the right command. git pull or git fetch?
对不起,我是git的新手.
I am sorry, I am very new to git.
推荐答案尝试一下:
git init git fetch url-to-repo branchname:refs/remotes/origin/branchname编辑
更好的解决方案:
git clone -b mybranch --single-branch git://sub.domain/repo.git更多推荐
Git:从主分支以外的分支克隆
发布评论