如何修复git子模块更新--init --recursive不拉CMakeLists.txt? [英] How to fix git submodule update --init --recursive not pulling CMakeLists.txt?

查看:84
本文介绍了如何修复git子模块更新--init --recursive不拉CMakeLists.txt?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个git子模块的项目.对于每个子模块和主项目,我都有 CMakeLists.txt .当我 git clone 主项目时,git拉出主 CMakeLists.txt .但是,当我执行 git子模块更新--init --recursive 时,git将拉除所有子模块,除了每个子模块中的 CMakeLists.txt .单独克隆子模块可以正常工作.我该如何解决?

I have a project with several git submodules. I have CMakeLists.txt for each submodule and for the main project. When I git clone the main project, git pulls the main CMakeLists.txt. However when I do git submodule update --init --recursive, git pulls all the submodules, except the CMakeLists.txt in each submodule. Cloning the submodules invidually works properly. How do I fix this?

project/
  - CMakeLists.txt
  - src/
    - main.cpp
  - lib/
    - CMakeLists.txt
    - moduleA/
        -CMakeLists.txt
        - fooA.cpp
        - fooA.h
        - barA.cpp
        - barA.h
    - moduleB/
        - CMakeLists.txt
        - fooB.cpp
        - fooB.h

推荐答案

虽然重新克隆一切正常,但更新也应该有效.

While re-cloning everything will work, updating should have worked too.

也许这些文件是在这些子模块的最新版本中引入的:

Maybe those files were introduced in a more recent version of those submodules:

git submodule update --remote --recursive

这将获取这些子模块中的最新子模块(默认为 master )

That would fetch the latest of those submodules (master by default)

这篇关于如何修复git子模块更新--init --recursive不拉CMakeLists.txt?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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