简体   繁体   English

如何在本地克隆子模块的'git clone --recursive'?

[英]How can I get 'git clone --recursive' to clone submodules locally?

I'm in the habit of making a git clone to a master location on my disk and then using a local git clone from there to cut down on download and copy times. 我习惯于将git克隆到磁盘上的主位置,然后使用本地的git克隆来减少下载和复制时间。

However, if I clone a project that has submodules, git clone --recursive , it will use --local for the main repo, but the submodule initialization is still by reference to URLS, which means I'm still going and doing a download again. 但是,如果我克隆一个具有子模块的项目, git clone --recursive ,它将使用--local作为主repo,但子模块初始化仍然是通过引用URLS,这意味着我仍然要去做下载再次。

Is there a way to make git clone --recursive clone from the local copies of submodules instead of the canonical locations? 有没有办法从子模块的本地副本而不是规范位置进行git clone --recursive clone?

this is my savior always: 这总是我的救世主:

git submodule update --init --recursive

This, initializes submodules and clones them even if you have submodules within submodules. 这样,即使子模块中有子模块,也会初始化子模块并克隆它们。 I have an alias in my bash_profile for this and always use this for empty repositories and for simple update operations 我在我的bash_profile中有一个别名,并且总是将它用于空存储库和简单的更新操作

alias gsu='git submodule update --init --recursive'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM