克隆特定分支

编程入门 行业动态 更新时间:2024-10-21 04:07:39
本文介绍了克隆特定分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是git版本控制的新手,我不知道如何克隆/拉出特定的分支。尝试获取项目的分支 master ,但默认为分支 test_1

我尝试过使用命令 git clone ,但它抓取了默认的 test_1 。我也尝试阅读其他问题,但命令混淆了我,我不想破坏任何东西。

我如何克隆这个项目的主分支,所以我可以你可以使用下面的标志 - 单分支

code>&& - 深度下载特定分支并限制下载的历史记录数量。

您会从某个时间点克隆回购,并且仅限于给定的分支

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’s HEAD 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

更多推荐

克隆特定分支

本文发布于:2023-07-17 02:45:45,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:分支

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!