Git子模块的使用方法

Git子模块是什么?

将另一个仓库作为子模块加载。

需要的指令

git submodule add https://github.com/hogehoge.git

推荐的指令

git submodule add --name 任意の名前 --branch ブランチ名 https://github.com/hogehoge.git サブモジュールを拡張するディレクトリへの相対パス

总结

git submodule add 引数s URL サブモジュールを拡張するディレクトリへの相対パス

请注意

如果以 Git Clone 新建导入了含有子模块的父仓库,子模块不会自动导入。
通过在克隆命令后添加 **–recursive** 可解决此问题。

git clone https://github.com/parents_of_hogehoge.git --recursive
广告
将在 10 秒后关闭
bannerAds