转自 http://davidwalsh.name/git-remove-submodule
For many git-based projects, submodules are useful in avoiding duplicate work and easing utility library updates. There are times, however, when a submodule needs to be removed from a project. Submodules aren't removed with git rm submoduledir, they must be removed in a more tedious, manual fashion. There are many unclear explanations of how to remove a submodule but I found one on Stack Overflowthat's concise, so I thought I'd share it. The steps are as follows:
- Delete the relevant section from the
.gitmodules
file. The section would look similar to:[submodule "vendor"] path = vendor url = git://github.com/some-user/some-repo.git
- Stage the
.gitmodules
changes via command line using:git add .gitmodules
- Delete the relevant section from
.git/config
, which will look like:[submodule "vendor"] url = git://github.com/some-user/some-repo.git
- Run
git rm --cached path/to/submodule
. Don't include a trailing slash -- that will lead to an error. - Run
rm -rf .git/modules/submodule_name
- Commit the change:
- Delete the now untracked submodule files
rm -rf path/to/submodule
Those steps will get you rid of that unwanted submodule. A lot harder than adding one, eh?
备注:如果工程与工程之前互相依赖,则需要分别删除后,在进行submodule的关联
相关推荐
git子模块git submodule补充脚本,提供轻松的更新和删除。 git submodule update :不会像我期望的那样提取最新的子模块。 git submodule update --remote :更新所有可用的子模块。 git submodule remove : 不存在...
主要介绍了详解git submodule update获取不到最新提交的代码,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
主要介绍了详解git submodule HEAD detached 的问题,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
问题:如何使用git submodule命令部署azure web应用现象:使用git进行部署的过程中在执行git submodule add的命令时,如果UR
git代码检出、colone、切换分支,初始化所有子模块,将父模块的代码检出至本地等。
场景: 当你在一个Git 项目上工作时,...在Git 中, 可以用子模块submodule来管理这些项目,submodule允许将一个Git 仓库当作另外一个Git 仓库的子目录。这允许克隆另外一个仓库到你的项目中, 并且保持你的提交相对独立。
主要介绍了git中submodule子模块的添加、使用和删除的示例代码,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
主要介绍了详解git submodule使用以及注意事项,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
主要介绍了Git Submodule使用完整教程(小结),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
文章地址:https://blog.csdn.net/ymlxku/article/details/90439657 该python脚本主要解决的问题: 1、拉取工程代码时,子模块指向modules.json指定的branch或tag,避免拉到游离分支。 2、提交代码时取消子模块提交...
为了进行此设置,请将此存储库克隆到某个地方,运行git submodule init ,然后运行git submodule init git submodule update命令,然后将您的克隆添加到$ PATH中。 有些命令需要python2 。 如果在Windows上使用...
PX4目录下的.gitmodules文件,已替换成Gitee链接,可正常git submodule update。
主要介绍了Git Submodule管理项目子模块的使用,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
leetcode ...git_collect_sub 个人收集的有用项目,使用git submodule方式,引用已有项目。 项目环境 submodule的使用 参考: 增加submodule git submodule add https://SubModule.git 首次拉取 git clone ...
sub git子模块加速,等同于git submodule add get 就是单纯的下载功能 示例用法 clone功能:等效于 git clone cit clone # 示例 cit clone https://github.com/solider245/cit.git 如上图所示,输入一个数字,选择一个...
将“git submodule”添加到项目中。 由“build.gradle”中的“apply from”使用。 设置 git submodule add git@github.com:jakenjarvis/AndroidBuildGradleCommonLibrary.git gradle/commonlibrary git submodule ...
git视频教程.5.6.Git 命令 - git submodule.mp4 git视频教程.6-7.Git 命令 - git show、git shortlog、git describe、git bisect、git blame、git grep.mp4 git视频教程.8.1.Git 命令 - git cherry-pick.mp4 git视频...
submodule)就解决了这个问题。Git子模块功能允许你将一个Git仓库当作另外一个Git仓库的子目录。这允许你克隆另外一个仓库到你的项目中并且保持你的提交相对独立。首先需要两个版本库例如:1)一个公共的
精通Git对Git操作详细讲解及描述
Ext JS 5 GPLv3 库可从这个 git 存储库中作为 git-submodule 包含在您的项目中,只要您按照 Sencha 许可使用该库: 将其添加为子模块 要将此存储库作为 git-submodule 拉入您自己的 git 存储库,请从项目的根目录中...