目录

Git 子模块

目录

命令

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# clone项目并拉取子模块代码
git clone --recurse-submodules [git url]

# 初始化子模块并将其添加到本地仓库的配置文件中
git submodule init

# 用于同步子模块的 URL 信息
git submodule sync

# 更新子模块代码
git submodule update

# 更新子模块最新commit hash
git submodule update --remote
# 添加子模块最新的commit hash
git add .
# 提交
git commit -m 'sync submodule'