Search code examples
gitgithubgitlabgit-submodulesgit-config

Trigger automatic pull/push for submodule after new commit appear


I have a project A and I have added a submodule to another project B.

I see that the submodule used in A is referring to a particular commit, and I would like this to be updated every time a new commit appears in B.

Is it possible to trigger an automatic pull/push of the submodule in A when B is updated?
Or this procedure has to be done always by hand?


Solution

  • You might consider:

    You can set up GitLab CI/CD across multiple projects, so that a pipeline in one project can trigger a pipeline in another project. You can visualize the entire pipeline in one place, including all cross-project inter-dependencies.

    Your first pipeline would be triggered only on pushes.
    And it includes a trigger to your project A, which would then execute a git submodule update --remote, in order to update the submodule B.