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

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

问题描述

我有一个包含子模块的 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 子模块 url 已更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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