Using submodules on git

Add a submodule

Run the following command, then you can commit and push it.

git submodule add <remote url> <destination folder>

Update submodules

Run the following command to update your local configuration file.

git submodule update --init --recursive

Then you can pull all the submodules right now.

git submodule foreach --recursive git pull origin master

Remove submodules

Run the following commands, then you can commit and push it.

git submodule deinit <submodule path>
git rm <submodule path>

Add submodules summary to git status

git config --global status.submoduleSummary true

Add submodules differences to git diff

git config --global diff.submodule log



Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • How to debug MSVC in release mode
  • How to change the line endings in Linux
  • How to find the vc runtime version from an exe
  • How to debug local variable and lambda on c++ release build
  • Why auto is bad in c++