I use GitLab flow environment branches in GitHub service.
I have 3 secured from direct commits branches main (dev branch), staging (pre-prod) and production branches.
I deployed release-1 to production. After that I merge significant code refactoring to main branch. In prod I found an issue in module which I refactored in main branch and need to fix it in prod. I couldn't find such scenario in GitLab flow examples. So what can I do:
- Check out
hot-fix-1branch fromproduction. - Make a fix in
hot-fix-1branch. - Merge this fix to
stagingto test. - If everything OK, I merge from
stagingtoproduction.
Because module is refactored in main branch fix should be done in a different way in main. So I create new branch from main, fix the issue and merge back to main. Is this correct?
Now I added Feature2 to main branch and want to release it. When I create PR from main to staging I will get a conflict. To resolve this conflict I need to merge staging to main and resolve the conflict. But this contradicts with GitLab flow.
How would you do hot fix in production in case of significant code change in problem module in dev branch?
