Modify submodule locally.
Before making any modifications, since the submodule is in the detached state, you need to enter the directory of the submodule and switch to a branch. git checkout <branch-name>
If you make any changes later, just commit them in the submodule directory.
Afterwards, when updating the submodule, it can be executed in the repo directory:
This is the deployment script currently used in our project, FYI
git submodule init
git submodule update
git submodule foreach 'git pull'
Execute git submodule init first
Then git submodule update
Clone project with submodule:
Reference
Update project with submodule:
Reference
Modify submodule locally.
orBefore making any modifications, since the submodule is in the detached state, you need to enter the directory of the submodule and switch to a branch.
git checkout <branch-name>
If you make any changes later, just commit them in the submodule directory.Afterwards, when updating the submodule, it can be executed in the repo directory: