Vue Storefront is now Alokai! Learn More
Using Git Submodules

Using Git Submodules for team separation

While not the recommended approach, Git submodules can be a necessary solution when multiple teams need to work on the same project while maintaining separate repositories. This pattern is particularly useful when you have a core team developing base stores and brand teams working on specific brand implementations.

When to use Git submodules

Consider using Git submodules when:

  • You need to maintain strict separation between core and brand-specific code
  • Different teams need to work in isolated repositories
  • The core team needs to control access to base store implementations
  • Brand teams should only have access to their specific brand store code
  • You need to ensure brand teams cannot modify core store logic

Implementation approach

To implement this pattern:

  1. Core team maintains the base store implementation in a separate repository
  2. Brand team's repository includes the core repository as a Git submodule
  3. Create a synchronization script that:
    • Pulls the latest core content from a specified branch or tag
    • Copies core files to the appropriate locations in the brand store
    • Maintains the agreed-upon version of core functionality

Trade-offs to consider

While this approach can work, it comes with significant trade-offs:

  • Increased complexity in repository management
  • More challenging version control and conflict resolution
  • Additional overhead in maintaining synchronization scripts
  • Potential delays in getting core updates to brand stores
  • More complex deployment and CI/CD pipelines

This approach should be used as a last resort when other solutions (like multistore or NPM packages) cannot meet your requirements. The complexity and maintenance overhead of Git submodules can significantly impact development velocity and team collaboration.