-
Notifications
You must be signed in to change notification settings - Fork 0
Working with submodules in VS Code
A submodule is a git repository inside a git repository. In this use-case each customer project is its own repository. And while each dashboard is unique in some ways, many graphs, api requests and calculations are shared across these different dashboards. In order to reduce the copy-pasted code and to streamline the development, these common objects should be shared across the different repositories. Submodules solve this problem.
Entering the Source Control pane on the left side of VS Code, instead of a single git repository, the pane should now show 2 repositories, each with their own files and changes. Any changes made to the main project are submitted just as usual to the git repo of the project. Any changes in the submodule can be committed by simply opening the dashboard_components git dropdown and proceed as with regular repositories.
The main repository store what commit the submodule is supposed to be at. So if somebody else changes the submodule, this should not affect your project. If you want to incorporate the latest version of the submodule you need to do 2 things:
- Do git pull on the submodule
- Stage and commit the update of the submodule.
The main repository should now point to the latest version of the submodule.
Any code that can be used by more than one dashboard should be inside the submodule. The code needs to be written in a dashboard agnostic way, meaning other dashboards can use it out of the box.