我的主存储库中有一个名为third-party的子模块。由于这个模块太大,我在工作区中创建了一个指向third-party文件夹的符号链接。不幸的是,我已经把这个符号链接到我的分支中,作为大脂肪合并的一部分!基本上,我用一个符号链接替换了一个子模块。
我已经尝试删除链接和子模块的更新,它没有帮助。
详细信息:
cat .gitmodules输出以下内容
[submodule "third-party"]
path = third-party
url = http://my-git-server/third-party.gitls -la输出以下内容
drwxr-xr-x 3 user admin 136 Jul 26 17:57 some-folder
drwxr-xr-x 3 user admin 102 Jul 26 17:57 third-party -> /some/dead/path我不知道如何从这种情况中恢复过来。任何帮助都是非常感谢的。
发布于 2016-07-27 09:33:14
我尝试了多种方法,最后,下面的方法起了作用。解决这一问题的更好方法是受欢迎的!
#delete the symlink
rm third-party
#delete the symlink from git
git rm third-party
#remove the submodule
cat /dev/null>.gitmodules
#commit the changes
git add .
git commit -m "Removing third-party as submodule"
#add the submodule again
git add submodule http://my-git-server/third-party.git third-party
#get the latest code from the submodule
git submodule update --remote这解决了我的问题。虽然第三方现在指向的提交哈希是不同的,但是当我执行git submodule update --remote时,我得到了最新的代码!
https://stackoverflow.com/questions/38590277
复制相似问题