Git子模块网址已更改 [英] Git submodule url changed

查看:44
本文介绍了Git子模块网址已更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含子模块的Git项目.子模块的url最近已更改.我已经更改了.gitmodules和配置文件以指向新的URL.我应该提交.gitmodules文件,以便下次我检出项目并执行git submodule update --init --recursive我不会收到错误消息吗?

I have a Git project which has a 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 won't get an error?

推荐答案

是的,在编辑.gitmodules之后,您应该提交并推送这些更改,以便所有人都可以使用该更改.否则,只有您的本地子模块会指向新的URL,其他人仍将指向旧的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.

但是,您不需要提交本地更改URL,如果您尚未提交更改,git还将切换到新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.

这篇关于Git子模块网址已更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆