如何git克隆特定标记

 nnyoyo8 发布于 2023-02-13 20:08

来自git-clone(1)手册页

--branch 也可以在结果存储库中的提交处获取标记并分离HEAD.

我试过了

git clone --branch  

但它不起作用.它返回:

warning: Remote branch 2.13.0 not found in upstream origin, using HEAD instead

如何使用此参数?

3 个回答
  • git clone --branch <tag_name> <repo_url>
    

    git 1.7.9.5不支持此命令.

    我使用git 1.8.3.5,它的工作原理

    2023-02-13 20:11 回答
  • 使用--single-branch选项仅克隆导致标记提示的历史记录.这样就可以节省大量不必要的代码.

    git clone <repo_url> --branch <tag_name> --single-branch
    

    2023-02-13 20:11 回答
  • git clone -b 13.1rc1-Gotham  --depth 1  https://github.com/xbmc/xbmc.git
    Cloning into 'xbmc'...
    remote: Counting objects: 17977, done.
    remote: Compressing objects: 100% (13473/13473), done.
    Receiving objects:  36% (6554/17977), 19.21 MiB | 469 KiB/s    
    

    将比以下更快:

    git clone https://github.com/xbmc/xbmc.git
    Cloning into 'xbmc'...
    remote: Reusing existing pack: 281705, done.
    remote: Counting objects: 533, done.
    remote: Compressing objects: 100% (177/177), done.
    Receiving objects:  14% (40643/282238), 55.46 MiB | 578 KiB/s
    

    要么

    git clone -b 13.1rc1-Gotham  https://github.com/xbmc/xbmc.git
    Cloning into 'xbmc'...
    remote: Reusing existing pack: 281705, done.
    remote: Counting objects: 533, done.
    remote: Compressing objects: 100% (177/177), done.
    Receiving objects:  12% (34441/282238), 20.25 MiB | 461 KiB/s
    

    2023-02-13 20:11 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有