克隆特定分支 [英] Cloning specific branch
问题描述
我是git版本控制的新手,我不知道如何克隆/拉出特定的分支。尝试获取项目的分支 master
,但默认为分支 test_1
我尝试过使用命令 git clone
,但它抓取了默认的 test_1
。我也尝试阅读其他问题,但命令混淆了我,我不想破坏任何东西。
我如何克隆这个项目的主分支,所以我可以你可以使用下面的标志 - 单分支
- 深度
下载特定分支并限制下载的历史记录数量。 您会从某个时间点克隆回购,并且仅限于给定的分支
git clone -b< branch> - 单分支< url> --depth<提交次数>
- [no-] single-branch
克隆仅导致单一分支尖端的历史记录
- 分支
选项或主分支远程的HEAD
分数,
在。
进一步提取到生成的存储库将只会更新此选项用于的分支的
远程跟踪
分支最初的克隆。如果在- 单分支
克隆时远程的HEAD没有指向任何分支,则不会创建远程跟踪分支。
- 深度
创建一个历史截断为指定数量的提交的浅表副本
I am new to git version control and I dont know how to clone / pull a specific branch of a repo . Trying to get the branch master
of the project, but it defaults to branch test_1
I have tried using the command git clone
but it grabbed default test_1
. I have also tried reading other questions but the commands are confusing me and I dont want to break anything.
How do i clone the master branch of this project so i can make changes and push to it?
You can use the following flags --single-branch
&& --depth
to download the specific branch and to limit the amount of history which will be downloaded.
You will clone the repo from a certain point in time and only for the given branch
git clone -b <branch> --single-branch <url> --depth <number of commits>
--[no-]single-branch
Clone only the history leading to the tip of a single branch, either specified by the
--branch
option or the primary branch remote’sHEAD
points at.Further fetches into the resulting repository will only update the
remote-tracking
branch for the branch this option was used for the initial cloning. If the HEAD at the remote did not point at any branch when--single-branch
clone was made, no remote-tracking branch is created.
--depth
Create a shallow clone with a history truncated to the specified number of commits
这篇关于克隆特定分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!