使用Git Submodule管理子模块 - daaoling/daaoling.github.io GitHub Wiki

Tags:Git

https://segmentfault.com/a/1190000003076028

add git submodule

git submodule add https://github.com/cloudwu/pbc third_libs/pbc

$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

    new file:   .gitmodules
    new file:   third_libs/pbc

update submodule

cd third_libs/pbc
git pull origin master

delete git submodule

step:

remove from .git/config

$ git submodule deinit third_libs/pbc  
Submodule 'third_libs/pbc' (https://github.com/cloudwu/pbc) unregistered for path 'third_libs/pbc'

remove from .gitmodules

git rm $submodule path

$ git rm -f third_libs/pbc
rm 'third_libs/pbc'

rm -rf $submodulepath rm -rf .git/modules/$submodulepath

⚠️ **GitHub.com Fallback** ⚠️