[英]How do I delete a submodule on GitHub?
I accidentally created a submodule on GitHub after forcing a commit. 强制提交后,我不小心在GitHub上创建了一个子模块。 For some reason, I can't wipe my repository and start over so I need some way to delete the submodule so I can recommit.
由于某种原因,我无法擦除存储库并重新开始,因此我需要某种方式删除子模块,以便重新提交。 Is there any way I can delete the submodule through my terminal?
有什么办法可以通过终端删除子模块?
If it actually is a submodule, meaning your GitHub repo also have a .gitmodules
files recording the associated path of that submodule, see my answer here : 如果它实际上是一个子模块,则意味着您的GitHub存储库中也有一个
.gitmodules
文件记录该子模块的关联路径,请在此处查看我的答案 :
1. git submodule deinit -f -- a/submodule
2. rm -rf .git/modules/a/submodule
3. git rm -f a/submodule
Then commit and push. 然后提交并推送。
But if it is a simple gitlink , displayed as a grayed folder on GitHub, as shown here , then just remove it locally and push: 但是,如果它是一个简单的gitlink ,在GitHub上显示为灰色文件夹( 如此处所示) ,则只需在本地将其删除并推送:
git rm -f a/submodule
git commit -m "remove submodule gitlink"
git push
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.