简体   繁体   English

如何从github存储库中删除子模块?

[英]How do I remove a submodule from my github repository?

I happened to change a name of a directory within my local repository and then proceeded to push this change up to my github repository. 我碰巧在本地存储库中更改了目录名称,然后继续将此更改推送到我的github存储库中。 In effect, it caused this repository to turn into a git submodule which is displayed as a green icon on github and there is no way to drill down further in to the directory to view individual files. 实际上,它导致该存储库变成git子模块,该子模块在github上显示为绿色图标,并且无法进一步深入查看该目录以查看单个文件。

How do I remove the submodule from github? 如何从github删除子模块?

Remove the directory as file. 删除目录作为文件。

git rm --cached path/to/directory

Note that you don't use a trailing slash. 请注意,您不要使用斜杠。 This will delete the special file that point to the commmit in the subrepository. 这将删除指向子存储库中提交的特殊文件。

Remove the .git folder inside the /path/to/directory before re-adding the directory into the index. 在将目录重新添加到索引之前,请删除/ path / to /目录中的.git文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用子模块更新GitHub分叉存储库 - How do I update a GitHub forked repository with submodule 如何从主 git 存储库中删除未跟踪的目录树(子模块/子存储库)? - How do I remove untracked directory tree (submodule / sub-repository) from main git repository? 如何删除特定 Github 存储库的“贡献的存储库”? - How do I remove my “repository contributed to” for a specific Github repo? 从github克隆了一个git仓库-我如何在我的账户中创建一个新的github仓库 - cloned a git repository from github - how do i create a new github repository into a repository into my account 如何从GitHub下载克隆我的存储库以进行维护? - How do I download clone my repository from GitHub for maintenance? 如何将更改从我自己的存储库的子模块推送到其他人的存储库(我是合作者)? - How do I push changes to someone else's repository (I'm a collaborator on), from a submodule of my own repository? 如何删除子模块? - How do I remove a submodule? 如何推送我从 github 克隆的存储库并对我的 github 存储库进行更改? - How do I push the repository I cloned from github and made changes to it to my github repo? 如何在GitHub上删除子模块? - How do I delete a submodule on GitHub? 如何从我的存储库中的github文件中删除文件路径? - How to remove file paths from github files in my repository?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM