用'--depth'选项浅显地更新git子模块 [英] Update git submodules shallowly with the '--depth' option

查看:903
本文介绍了用'--depth'选项浅显地更新git子模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

git子模块更新支持 - 深度选项,如answer



但是我们仍然无法轻易确定深度值,这可能会使git无法找到子模块的预期修订版。



有没有真正的解决方案来更新子模块?

解决方案


因此,我认为确切的深度仍然是一个神话,这是唯一的,必须解决问题的关注


虽然确实没有确切的深度,但仍可以使用git 2.9.x +(Q3 2016)记录深度建议。



请参阅提交abed000 提交37f52e9 (2016年5月26日)作者: Stefan Beller( stefanbeller

(由 Junio C Hamano - 提交 gitster -
$ b


子模块更新:learn - [no-] recommend-shallow option



上游项目可以建议在$ .gitmodules 文件中克隆
中的一些子模块。



有时子模块的历史记录是对于下游用户来说,允许一个布尔字段'子模块。< name> .shallow 'in .gitmodules ,其中可以用来推荐上游是否认为历史是重要的。



默认情况下,此字段在初始克隆中可以使用,它可以被
忽略, code> - no-recommend-shallow 选项。

这样,一个简单的 git submodule update (没有附加参数)将使用建议的深度值(如果找到的话)。 href =https://stackoverflow.com/a/38895397/6309> Git submodule without weight weight with:

  git config -f .gitmodules submodule。< name> .shallow true 


git submodule update has supported the --depth option as described in this answer.

But still we can't easily determine the depth value, which would probably make git unable to find the intended revision of a submodule.

Is there a true solution for updating submodules shallowly?

解决方案

So I think the exact depth would still be a myth, which is the only and must be resolved concern of the question

While there is indeed no "exact depth", you can still record a "depth recommendation" with git 2.9.x+ (Q3 2016).

See commit abed000, commit 37f52e9 (26 May 2016) by Stefan Beller (stefanbeller).
(Merged by Junio C Hamano -- gitster -- in commit 3807098, 20 Jun 2016)

submodule update: learn --[no-]recommend-shallow option

An upstream project can make a recommendation to shallowly clone some submodules in the .gitmodules file it ships.

Sometimes the history of a submodule is not considered important by the projects upstream.
To make it easier for downstream users, allow a boolean field 'submodule.<name>.shallow' in .gitmodules, which can be used to recommend whether upstream considers the history important.

This field is honored in the initial clone by default, it can be ignored by giving the --no-recommend-shallow option.

That way, a simple git submodule update (no additional parameters) will use the recommended depth value, if found.

See also "Git submodule without extra weight" with:

git config -f .gitmodules submodule.<name>.shallow true

这篇关于用'--depth'选项浅显地更新git子模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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