跳至正文
Wener Notes

Git Submodule

约 1 分钟阅读
bash
# 推荐
git config --global submodule.recurse true

# 添加
git submodule add https://example.com/submodule-repo.git path/to/submodule
# 已有
git submodule init
git submodule update
# clone 包含 submodule
git clone --recurse-submodules http://example.com/repo.git
# 全部更新
git submodule update --remote --recursive

.gitmodules

.git

text
gitdir: ../.git/modules/stub

FAQ

local submodule

bash
git -c protocol.file.allow=always submodule add ~/gits/wenerme/kube-stub-cluster/.git stub

detached

bash
# merge 或 rebase 即可
git submodule update --remote --merge
git submodule update --remote --rebase

关联信息

反向链接、本文链接的其他页面和外部资料。

参考资料

Hacker News1 条
其他外链2 条
最近更新commit 19f1422编辑