这是我.gitmodules文件内容的一部分:
[submodule "src/static_management"]
path = src/static_management
url = git://github.com/eykd/django-static-management.git
[submodule "external/pyfacebook"]
path = external/pyfacebook
url = http://github.com/sciyoshi/pyfacebook.git
Run Code Online (Sandbox Code Playgroud)
但是,.git/config只包含第一个:
[submodule "src/static_management"]
url = git://github.com/eykd/django-static-management.git
Run Code Online (Sandbox Code Playgroud)
第二个子模块(external/pyfacebook)由功能分支中的另一个开发人员添加.我现在继承了开发,并检查了功能分支.但是,Git不会为我拉这个子模块.我试过了:
git submodule initgit submodule updategit submodule update --initgit submodule sync.git/config并运行git submodule init.它只复制先前存在的子模块并忽略新的子模块..git/config手动输入新的子模块定义并运行git submodule update.只有以前存在的子模块才能更新.在各种组合中,但是git根本不会.git/config根据新内容进行更新.gitmodules,也不会创建external/pyfacebook文件夹并拉出子模块的内容.
我错过了什么?手动干预(手动添加子模块条目.git/config)是否真正需要,为什么?
编辑:手动干预不起作用.手动添加新的子模块条目.git/config不会做任何事情.新的子模块被忽略.
如何用不同的git repo替换git子模块?
具体来说,我有一个子模块:
./ExternalFrameworks/TestFramework那个点到git repogit@github.com:userA/TestFramework.git git@github.com:userB/TestFramework.git.问题是当我用这里描述的方法删除子模块时,然后使用该命令重新添加它
git submodule add git@github.com:userB/TestFramework.git
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
A git directory for 'ExternalFrameworks/TestFramework' is found locally with remote(s):
origin git@github.com:userA/TestFramework.git
If you want to reuse this local git directory instead of cloning again from
git@github.com:userB/TestFramework.git
use the '--force' option. If the local git directory is not the correct repo
or you are unsure what this means choose another name with the '--name' option.
Run Code Online (Sandbox Code Playgroud)