我有一个子模块回购,当远程调用其主分支master时,它添加到了我的项目中。现在,他们将它重命名为main,当我试图拉动时,我得到了错误:
Your configuration specifies to merge with the ref 'refs/heads/master'
from the remote, but no such ref was fetched.我想我可以用核弹把子模块再加进去。但还有更优雅的解决方案吗?
发布于 2022-07-13 08:51:39
存储库中至少有一个.gitmodules文件,它应该有如下所示
[submodule "foo"]
path = bar
url = https://github.com/baz/foo
branch = master如果branch不在,则默认为master。您可以添加branch = main。如果它在那里,将其更改为branch = main。提交.gitmodules中的更改并运行git submodule update --remote来更新子模块。
正如@torek所提到的,我们还可以使用git submodule set-branch -b main -- foo更新子模块的分支。请注意,对于子模块名称,它不是foo/,而是没有斜杠的foo。
https://stackoverflow.com/questions/72963011
复制相似问题