我是靠谱客的博主 害羞魔镜,这篇文章主要介绍git 在 A 项目中引用 B 项目1 添加仓库2 更新仓库参考博客git submodule: already exists in the index,现在分享给大家,希望可以做个参考。
Git Submodule 可许可一个git仓库,作为另一个git仓库的子目录,保持父项目和子项目相互独立。
1 添加仓库
git submodule add <仓库地址> <本地路径>
在父仓库根目录增加了.gitmodule文件
// 添加submodule字段
[submodule "submodule1"]
url = *****.git
2 更新仓库
克隆父亲仓库(包含子目录),并不会clone下子仓库的文件,只是会克隆下.gitmodule描述文件
我们需要使用下面命令更新
// 初始化本地配置文件
$ git submodule init
// 检出父仓库列出的commit
$ git submodule update
参考博客
git中submodule子模块的添加、使用和删除
https://blog.csdn.net/guotianqing/article/details/82391665
git submodule: already exists in the index
在 github 上面 clone 一个包含有 submodule 的 repo 的时候,用如下命令更新 submodule:
git submodule update --remote --merge
一直没法更新,尝试重新 add submodule,比如:
git submodule add https://github.com/cisco/openh264 open_source_code/openh264
一直报如下错误:
‘open_source_code/openh264’ already exists in the index
执行如下命令,解决此问题:
git rm -r --cached open_source_code/openh264
最后
以上就是害羞魔镜最近收集整理的关于git 在 A 项目中引用 B 项目1 添加仓库2 更新仓库参考博客git submodule: already exists in the index的全部内容,更多相关git内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复