【发布时间】:2015-04-24 14:24:31
【问题描述】:
从 Mac 上的 git 版本 1.9.3 (Apple Git-50) 开始,我如何删除 git 子模块?我正在阅读很多过时的信息,许多开发人员告诉我他们不会工作。目前的方式是什么?
git deinit pathToSubModule 会成功吗?
我认为可行的步骤是here,但 cmets 说他们不会。
让我解释一下我目前的情况以及我需要完成的工作。我已经安装了the Quick repository 并将其作为子模块添加到我的项目中。此代码已签入,其他人正在使用它。我现在需要做的是 fork 相同的快速存储库并将其托管在我公司拥有的更安全的 github 上(因此完全是其他私有 github)。分叉后,我想将该分叉添加为 gitSubmodule 并让它替换我之前安装的当前 Quick 子模块。
更新:我读到以下是最新版本的正确方法请确认?
To remove a submodule added using:
git submodule add blah@blah.com:repos/blah.git lib/blah
Run:
git rm lib/blah
That's it.
For old versions of git (circa ~1.8.5) use:
git submodule deinit lib/blah
git rm lib/blah
git config -f .gitmodules --remove-section submodule.lib/blah
【问题讨论】:
-
我已经解决了两天的子模块问题。当我发现这个时,突破就来了:forums.developer.apple.com/thread/13102。基本上,Xcode,也许还有其他应用程序,都在努力扩展包含“~”的 url。一旦我将 ssh://username@server.remoteHost.com/~/git/MyRepo.git 更改为 ssh://username@server.remoteHost.com/home/username/git/MyRepo.git (查找实际路径在您的服务器上),十分钟后所有的怪异消失了。
标签: git github git-submodules