Git サブモジュールは、1つの Git リポジトリを別の Git リポジトリ内にサブディレクトリとして埋め込むことができます。共有ライブラリまたは依存関係を個別のリポジトリとして含める場合に便利です。サブモジュールは強力ですが複雑さで知られているため、サブモジュールとその代替手段を理解することは価値があります。
サブモジュールとは
A SUBMODULE is a reference to ANOTHER Git repository at a SPECIFIC COMMIT, embedded in
your repo as a subdirectory:
→ the parent repo records WHICH repo and WHICH commit (a pinned reference, not a copy)
→ the submodule is its own repo with its own history
→ Used to include shared libraries/components that are themselves versioned repos.
git submodule add <url> path/to/lib
git --recurse-submodules <url>
git submodule update --init --recursive
git submodule update --remote
