我试着删除一个子模块,然后用git 1.8.5.2添加它。 子模块asub
增加了git submodule add -b master url_asub.git
。 我通过为什么删除后我不能添加一个git子模块
git rm asub
去除辅助模块中的ASUB目录不见了。然后我试图与它添加原始命令重新添加(以测试子模块去除1.8.5.2是干净的):
git submodule add -b master url_asub.git
我得到一个错误信息:
A git directory for 'asub' is found locally with remote(s):
origin url_asub.git
If you want to reuse this local git directory instead of cloning again from
url_asub.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.
我不确定这个错误信息的含义。我也试过在上层项目做git submodule sync
,并试图
git submodule deinit asub
git rm asub
git submodule add -b master url_asub.git
但我仍不能添加子模块背部。我错过了什么,或者这是git 1.8.5.2中的错误?
我想这样做的原因是a)删除子模块并b)将其添加回来以便它反映子模块的最新内容。这听起来似乎天真,但我发现submodule add -b
功能会在我克隆超级项目(how to keep git submodule on-branch status after cloning superproject?)后立即中断。所以我想出一个简单的方法来避免让子模块跟踪他们的主分支的所有麻烦就是删除子模块,并在每次克隆超级项目时将其添加回去。