git clone特定分支机构列表 [英] git clone specific list of branches

查看:74
本文介绍了git clone特定分支机构列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从远程仓库中克隆一个分支列表.不获取所有内容的最佳方法是什么? 我看到了克隆一个特定分支的解决方案,但我需要多个分支. 谢谢.

I want to clone a list of branches from remote repo. What is the best way to do that without fetching everything? I saw solutions for cloning one specific branch but I need multiple branches. Thank you.

我最终使用以下命令创建了一个包,然后将其用于我的目的:

I ended up using following command to create a bundle and then using it for my purposes:

git bundle create ../BUNDLE.bundle branch1 branch2 refs/notes

然后将这个捆绑包用于我的目的.

And then using this bundle for my purposes.

推荐答案

您从一个分支开始:

git clone --branch first URL localrepo

,然后获取其余所有内容:

and then fetch all the rest:

cd localrepo
for branch in second third etc; do
    git fetch origin $branch:$branch
done

或者没有循环

git fetch origin second:second third:third

这篇关于git clone特定分支机构列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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