Git Note--git submodule usage

Usage of git submodule command

0x00 add a submodule to a repo

Sometimes our project may depends on other’s git project,so,how to handle this dependence in git ,just use git submodule

1
git submodule add https://github.com/other/reponame reponame

after this command , git will create a sub directory named at current work directory,

1
2
3
4
5
6
ls reponame

#you may see something or nothing,because old version git will not auto pull submodule repo
#you can run the follow cmdline,manual pull submodule repo

git submodule update --init --recursive

0x01 clone a repo with it submodule repos

1
git clone --recursive <project url>

0x02 more useful info

https://github.blog/2016-02-01-working-with-submodules/