Git submodule is useful when you need another git repository inside your git project. This repository should not be library managed by dependency manager. Here is useful command I used to manage git submodule.
How to install/add new submodule to current repository
git submodule add <git repository url> <destination folder>
How setup existing submodule in cloned repository
git submodule init
git submodule update
How to update submodule
git submodule update
If you need to update the code inside of the submodule, you can just go to your submodule directory and update the code. After that point your cli to your submodule directory and do a commit & push like normal git repository. Make sure your update won't break another project that already use your submodule.
Top comments (0)