How to change the remote repository for a git submodule?

后端 未结 7 1398
醉梦人生
醉梦人生 2020-11-22 10:45

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

7条回答
  •  再見小時候
    2020-11-22 11:30

    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

提交回复
热议问题