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

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

问题描述

我如何浅克隆一个 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 克隆 repo 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

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

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