git子模块更新不起作用 [英] git submodule update not functioning

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

问题描述

我有一个带有各种嵌套子模块的存储库.提交和推送工作很好,并且更改按预期在GitHub上可见.

I have a repository with various nested submodules. Committing and pushing works pretty well and the changes are visible at GitHub as expected.

在测试/生产环境中,正在使用以下命令部署该项目的新版本:

In the testing/production environments, new releases of this project are being deployed using these commands:

git pull --recurse-submodules
git submodule update --init --recursive

但这只会更新根项目,没有一个子模块被更新为与GitHub上的HEAD关联的提交.到目前为止,我发现更新整个项目的唯一方法是在每个单独的子模块文件夹中运行 git pull .

But this only updates the root project, none of the submodules are updated to the commits associated with the HEAD at GitHub. So far the only way I have found to update the whole project is to run git pull inside each individual submodule folder.

我知道 git子模块更新是大多数地方引用的方法,但是在这种情况下,它实际上并没有产生任何结果.可能是什么原因?

I understand that git submodule update is the method referenced in most places, but it is not really producing any results in this case. What could be the cause?

推荐答案

您需要确保子模块在分支之后,否则它们只会在特定的SHA1处签出(不是最晚在分支中签出,而是您的父存储库索引的特殊条目)

You need to make sure your submodules are following a branch, or they will only be checked out at a specific SHA1 (not at the latest of a branch, but the special entry of the index of your parent repo)

请参见" Git子模块:指定分支/标记".为了使您的子模块遵循一个分支.

See "Git submodules: Specify a branch/tag" in order to make your submodule follow a branch.

然后 git子模块更新--init --recursive --remote 就足以从该分支签出最新消息.

Then a git submodule update --init --recursive --remote would be enough to check out the latest from that branch.

此( git子模块更新--remote )需要git 1.8.2+(2013年3月).有一个git1.7.9.5 (2012年3月)不提供此功能.

This (git submodule update --remote) requires git 1.8.2+ March 2013. The OP Luís de Sousa has a git 1.7.9.5 (March 2012) which doesn't offer this feature. 

这篇关于git子模块更新不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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