How to integrate a git submodule to a git workflow

970 Views Asked by At

Here's my situation : my team and I have a project using a front end framework. It works great and is correctly organized with a typical git workflow with master, develop and features/fixes branches.

We now have an increasing need to add a large number of translations to our project (translations are located in a single folder). We decided to try out Weblate to manage them. Right now, Weblate has a full access to our entire git repository to push translations.

For security reasons, we want Weblate to only have access to our translation folder. We thought we could create a git submodule for the translation and give weblate an access to it.

Unfortunately, I am not sure of how we could easily integrate a submodule to our current workflow.

I thought of a solution but I am not sure it is possible : I want to create a submodule with a workflow similar to the main project. When a developer (or weblate) wants to update a translation, he has to create a feature branch on both the main project and the submodule and then merge both branch when the feature is finished.

I am not familiar with git submodules and there is probably a smarter way to do this so your thoughts on this would be very much appreciated :)

1

There are 1 best solutions below

0
On BEST ANSWER

The simplest approach would be to reference in your main project the translation folder/submodule, set to follow the latest commit from its main branch.

That means at any point in your main repository, a git submodule update --remote will update the submodule to its latest commit.

That way, you can have a pull-request/merge policy within your separate translation repository, and, once reviewed and merged in its main branch, a submodule update --remote in the main repository will get the latest revision of that submodule.