我有一个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.
更多推荐
发布评论