Skip to main content

submodule

创建 submodule

git submodule add [email protected]:jjz/pod-library.git pod-library

git submodule add https://github.com/fivge/doc.git docs

其实就是创建了个 .gitmodules 及对应的目录 文件

.gitmodules

[submodule "docs"]
path = docs
url = https://github.com/fivge/doc.git

docs

diff --git a/docs b/docs
new file mode 160000
index 0000000..ac54805
--- /dev/null
+++ b/docs
@@ -0,0 +1 @@
+Subproject commit ac54805c60f48bb4d727c31e08d671a5a449c4b5

仅拉取

git pull
# 初始化
git submodule init
git submodule update

同步

git submodule foreach git pull

git add docs/ && git commit -m "update git submodule" && git push
git rm --cached pod-library