Git子模块网址已更改(Git submodule url changed)

系统教程 行业动态 更新时间:2024-06-14 16:57:18
Git子模块网址已更改(Git submodule url changed)

我有一个git项目,它有一个git子模块。 最近更改了子模块的URL。 我已将.gitmodules和配置文件更改为指向新的URL。 我应该提交.gitmodules文件,以便下次我签出我的项目并执行git子模块更新--init --recursive我不会收到错误吗?

I have a git project which has a git submodule. The url of the submodule was recently changed. I have changed the .gitmodules and config file to point to the new url. Should I commit the .gitmodules file so that the next time I checkout my project and do git submodule update --init --recursive I wont get an error?

最满意答案

是的,在编辑.gitmodules ,您应该提交并推送这些更改,以便所有人都可以使用此更改。 否则,只有您的本地子模块会指向新URL,其他所有人仍然会使用旧URL。

但是,您不需要提交本地更改URL,如果您尚未提交更改, git也将切换到新URL。

Yes, after editing .gitmodules, you should commit and push those changes, so the change becomes available to everyone. Otherwise, only your local submodule would point to the new URL and everyone else would still the old URL.

However, you don't need to commit to change the URL locally, git will also switch to the new URL if you haven't committed the change.

更多推荐

本文发布于:2023-04-12 20:25:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/8190746e2c69e2a0a641af4e99e39730.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模块   网址   Git   changed   url

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!