Changing remote repository for a git submodule
I've created a git repository with a submodule in it. I'm able to tell the submodule itself to change its remote repository path, but I'm not sure how to tell the parent repository how to change the remote repository path for the submodule.
I wouldn't be surprised if I'm somewhat out of luck and have to do things manually, as even deleting submodules isn't easy.
您应该只需编辑.gitmodules
文件即可更新URL,然后运行git submodule sync
将该更改反映到超级项目和工作副本中。
These commands will do the work on command prompt without altering any files on local repository
git config --file=.gitmodules submodule.Submod.url https://github.com/username/ABC.git
git config --file=.gitmodules submodule.Submod.branch Development
git submodule sync
git submodule update --init --recursive --remote
Please look at the blog for screenshots: Changing GIT submodules URL/Branch to other URL/branch of same repository
What worked for me (on Windows, using git version 1.8.3.msysgit.0):
git submodule init
and git submodule update
After doing all that, everything is in the state I would expect. I imagine other users of the repository will have similar pain when they come to update though - it would be wise to explain these steps in your commit message!
链接地址: http://www.djcxy.com/p/16426.html上一篇: 将Git子模块更新为最新的原始提交
下一篇: 更改git子模块的远程存储库