Changing Git Submodule Repository to other URL/Branch
List the details in .gitmodules file
$ git config --file=.gitmodules -l
This command lists all the submodules present in the current repository with their paths, URL location and the branch which it is mapped in the repository.
Output will be like:
submodule.themes/hugo-coder.path=themes/docker
submodule.themes/hugo-coder.url=https://github.com/user/coder.git
submodule.themes/hugo-coder.branch=docker
Edit the Submodule URL
This command will edit the URL of the submodule and will place it with the specified new URL repository.
$ git config --file=.gitmodules submodule.Submod.url https://github.com/username/ABC.git
Edit the Submodule Branch
$ git config --file=.gitmodules submodule.Submod.branch development
This command will edit the Branch docker
of the submodule and will place it in the specifified Branch development
.
Sync and update the Submodule
$ git submodule sync
$ git submodule update --init --recursive --remote
These commands will sync and update the submodule to the newly specified branch or URL successfully.
Subscribe
Read Related