Git 子模块添加到现有的非空文件夹
Git submodule add to an existing non empty folder
我正在尝试将带有我们公司 wp 插件的 git 存储库作为子模块添加到 wp 项目中:
git submodule add git@bitbucket.org:company/our-wp-plugins.git htdocs/wp-content/plugins/
首先我得到这个错误:
'htdocs/wp-content/plugins' already exists in the index
所以我用 git rm -r --cached htdocs/wp-content/plugins
从索引中删除了它,但是这次我得到了另一个错误:
'htdocs/wp-content/plugins' already exists and is not a valid git repo
我可以在不创建新子文件夹的情况下以某种方式将子模块添加到现有的非空文件夹吗?
Could I add somehow a submodule to an existing non-empty folder without creating a new subfolder?
不,子模块将创建自己的根文件夹(实际上是父仓库的 gitlink, a special entry in the index)
确保 .gitmodules
尚未注册该路径,并检查 .git/modules
文件夹的内容,然后再尝试另一个 git submodule add
。
我正在尝试将带有我们公司 wp 插件的 git 存储库作为子模块添加到 wp 项目中:
git submodule add git@bitbucket.org:company/our-wp-plugins.git htdocs/wp-content/plugins/
首先我得到这个错误:
'htdocs/wp-content/plugins' already exists in the index
所以我用 git rm -r --cached htdocs/wp-content/plugins
从索引中删除了它,但是这次我得到了另一个错误:
'htdocs/wp-content/plugins' already exists and is not a valid git repo
我可以在不创建新子文件夹的情况下以某种方式将子模块添加到现有的非空文件夹吗?
Could I add somehow a submodule to an existing non-empty folder without creating a new subfolder?
不,子模块将创建自己的根文件夹(实际上是父仓库的 gitlink, a special entry in the index)
确保 .gitmodules
尚未注册该路径,并检查 .git/modules
文件夹的内容,然后再尝试另一个 git submodule add
。