git浅克隆到特定的标记 [英] git shallow clone to specific tag

查看:96
本文介绍了git浅克隆到特定的标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想克隆Linux内核的repo,但只能从3.0版本开始,因为内核repo非常庞大,如果我可以做一个浅层克隆,我的版本管理工具运行得更快。我的问题的核心是:我怎么能告诉git的n值是--depth参数?我希望这会起作用:


git clone http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git --depth v3.0


谢谢。

解决方案

如何将标签克隆到1的深度?




  • git clone --branch mytag0.1 --depth 1 https://example.com/my/ repo.git



注意:


  • - 深度1 意味着 - 单分支,所以没有来自其他分支的信息如果要克隆本地存储库,请使用 file:// 而不是仅存储库路径


I want to clone the Linux kernel repo, but only from version 3.0 onwards, since the kernel repo is so huge it makes my versioning tools run faster if I can do a shallow clone. The core of my question is: how can I tell git what the "n" value is for the --depth parameter? I was hoping this would work:

git clone http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git --depth v3.0

thanks.

解决方案

How about cloning the tag to a depth of 1?

  • git clone --branch mytag0.1 --depth 1 https://example.com/my/repo.git

Notes:

  • --depth 1 implies --single-branch, so no info from other branches is brought to the cloned repository
  • if you want to clone a local repository, use file:// instead of only the repository path

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

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