如何在特定分支上克隆存储库? [英] How do I shallow clone a repo on a specific branch?

查看:72
本文介绍了如何在特定分支上克隆存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何浅层克隆git存储库,以使我的克隆仅包含1个历史项目,并从特定分支开始?

How do I shallow clone a git repository, so that my clone contains only 1 history item, and starts on a specific branch?

我知道该怎么做浅表克隆:

I know how to do a shallow clone:

git clone --depth 1 https://path/to/myrepo.git

但不在特定分支上启动克隆。

but not start the clone on a specific branch.

推荐答案

要使用分支 bar 克隆仓库 foo.git ,请执行以下操作:

To clone repo foo.git with branch bar do:

git clone --depth 1 https://path/to/repo/foo.git -b bar

请参阅git-clone文档: https://www.kernel.org/pub/software/scm/git/docs/git-clone.html

See the git-clone documentation: https://www.kernel.org/pub/software/scm/git/docs/git-clone.html

这篇关于如何在特定分支上克隆存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆