What is a submodule in git for?

Question:

One day I went to clone a library on github and there was an instruction for us to use the git submodule update command.

I've been working with git for some time and until then I wasn't aware of this command.

What is this submodule command for?

Answer:

This command is useful when you want to insert another git repository into your main project (a library, for example).

For git the submodule will be a fully independent project. You can edit the content below the submodule folder, commit, push, etc. As long as you have permission to do so 🙂

There are alternatives, such as package managers, that organize dependencies in other, more efficient and secure ways.

Scroll to Top