Skip to content

Submodules

Tags: git


Add submodule

Terminal window
git submodule add <repo URL>

Once you have added a submodule to a repo, it wont be pulled down automatically with a pull or clone. Run the below to pull/update the submodule.

Terminal window
git submodule init
git submodule update

Update submodules

Terminal window
git submodule update --recursive --remote

Force clean submodules

Terminal window
git submodule foreach --recursive git reset --hard

git submodule update —init —recursive —remote If the above doesnt work then

Terminal window
git submodule deinit -f .
git submodule update --init --recursive --remote

For some reason a change on a submodule was staged, so I got rid of it (this ended up being normal and was done again when I updated the submodule again)

Terminal window
git restore .\files\Get-SMART\ --recurse-submodules