git submodule
Embed another Git repository as a subdirectory within a Git repository
Syntax
git submodule [<subcommand>] [<options>]
Parameters
| Parameters | Description | Examples | Level |
|---|---|---|---|
add <url> [<path>] |
|
Common | |
init |
|
Common | |
update |
|
Common | |
update --init --recursive |
New | |
Common |
status |
|
Common | |
deinit <path> |
|
Common |
Examples
libs/utils
git submodule add https://github.com/lib/utils.git libs/utils
git submodule update --init --recursive
NewNew
git submodule update --remote
git clone --recurse-submodules <url>
New
git submodule foreach 'git pull origin main'
Tips
- git submodule update --init
- commit, NewNew
- Recommended(npm/pip),
- ,.gitmodules,.git/config and