Git submodule 子模塊的管理和使用


 

因為代碼分了兩個小組管理,一部分代碼使用跨平台語言實現,一部分使用原生實現。

所以使用Git submodule 來進行管理。

 

1,查看/更新 子模塊

$ git submodule add ssh://git@10.10.10.xx:443/xxx-iOS ios  #添加子模塊
$ git submodule (status)#查看子模塊
$ git submodule update  #更新項目內子模塊到最新版本

$ git submodule update --remote #更新子模塊為遠程項目的最新版本

$
git submodule foreach git pull

##以上方式均為更新master分支
 
 
  ## 使用下面的方式,更新 libb 的 dev 分支:
$ git config -f .gitmodules submodule.liba.branch dev $ git submodule update --remote

2,刪除子模塊

 

  1. 刪除子模塊文件夾
$ git rm --cached assets
$ rm -rf assets
  1. 刪除.gitmodules文件中相關子模塊信息
[submodule "assets"]
  path = assets
  url = https://github.com/maonx/vimwiki-assets.git
  1. 刪除.git/config中的相關子模塊信息
[submodule "assets"]
  url = https://github.com/maonx/vimwiki-assets.git
  1. 刪除.git文件夾中的相關子模塊文件
$ rm -rf .git/modules/assets

另一說
git rm --cached pod-library rm -rf pod-library rm .gitmodules


OVER

https://juejin.im/post/5aa11f486fb9a028e0140e34 

https://www.jianshu.com/p/9000cd49822c

https://www.jianshu.com/p/0107698498af

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM