git submodule

Cite: https://git-scm.com/book/en/v2/Git-Tools-Submodules#Starting-with-Submodules

MainProject 只追踪 git submodulecommit, 不追踪其内容.

Adding an existing Git repository as a submodule of the repository
that we’re working on

$ git submodule add j.ru@bl:~/git-server/data.git
$ gcam "add data.git module"

Cloning a Project with Submodules

$ git clone j.ru@bl:~/git-server/MainProject
$ cd MainProject
$ git submodule init
$ git submodule update

# There is another way to do this. If you pass `--recursive` to the
# `git clone` command, it will  automatically initialize and update 
# each submodule in the repository.
$ git clone --recursive j.ru@bl:~/git-server/MainProject

在 submodule 中更新 submodule 内容

$ gf
$ gmom
# 或者
$ gl

你可能感兴趣的:(git submodule)