2020年2月3日 星期一

[Git 文章收集] Changing Git Submodule Repository to other URL/Branch

Source From Here
List Submodule
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.

沒有留言:

張貼留言

[Git 常見問題] error: The following untracked working tree files would be overwritten by merge

  Source From  Here 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 #   git clean -d -fx 方案2: 今天在服务器上  gi...