Git submodule 子模塊的管理和使用

 

由於代碼分了兩個小組管理,一部分代碼使用跨平臺語言實現,一部分使用原生實現。ios

因此使用Git submodule 來進行管理。git

 

1,查看/更新 子模塊github

git submodule add ssh://git@10.10.10.xx:443/xxx-iOS ios  #添加子模塊$
查看子模塊$ git submodule (status)#
git submodule foreach git pull

$ git submodule update #更新項目內子模塊到最新版本

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

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

2,刪除子模塊vim

 

  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


OVERruby

http://www.javashuo.com/article/p-owdrsccp-kz.html bash

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

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

相關文章
相關標籤/搜索