We're working on git repo management for our client PMD beauty with multiple Shopify…
- User
We're working on git repo management for our client PMD beauty with multiple Shopify sites, all currently get built through a single repo
pmd-shopify. The sites include pmdbeauty.com(US), UK.pmdbeauty.com, EU.pmdbeauty.com, AU.pmdbeauty.com, CA.pmdbeauty.com sites. Sites operate using Github repo with each site having it's own unique master branch, in the formatmaster-uk,master-euetc. Then all branches feed back into the mainmasterbranch.We're running into an issue where each of the sites have their unique code in some files, but there's also common code that needs to be applied to all sites. What's the best way for us to manage the master so it can push to all regional site master branches, but each of the regional site branches can also feed back into master if the code belongs to a common feature shared between all sites. Can this be done using Github Submodules, if so, can you lay out step by step instructions of how the setup and execution should be.
- Assistant
It seems like you want to maintain a common codebase and also have unique code for each regional site. Instead of using separate master branches, I recommend using a single
masterbranch for the common codebase and separate branches for the unique code of each regional site. You can use Git Submodules to manage common/shared components, and here's how you can set it up:- Create a new repository for the shared components (common codebase), e.g.,
pmd-shopify-common.
- Create a new repository for the shared components (common codebase), e.g.,
- User
4a says common needs to be a sub-folder, in ours common files are stored at the same level as unique files for each store, is there a way to achieve this without having a separate folder for common files?
- Assistant
Yes, you can achieve this by using Git Subtree instead of Git Submodules. Git Subtree allows you to merge a separate repository into your main repository as a subdirectory, but the contents of the subdirectory are treated as part of the main repository. Here's how you can set up Git Subtree in your case:
- Add the shared components repository as a remote in each regional site repository:
csharpgit remote add pmd-shopify-common https://github.com/your-username/pmd-shopify-common.git
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.