- We have a mono-repository on Github, multiple teams work off of master by creating new branches based on master and creating pull requests regarding the features/bugfixes, etc.
- For my team, though, the majority of the time (though, not always), the things we work on cannot directly merge onto master, because it goes through the product manager’s approval and client’s approval which may take a while to implement, and the Epics that we work under require a very long time to deliver (usually 4 weeks of development, and 1 week of reviews/adjustments) hence require multiple team members to work on different pieces of it.
- To be able to work in such a branching strategy, we are currently working as follows:
- We create a new branch named as “releases/*” and that becomes our branch to be merged to master (meaning going live to production)
- We create sub-branches based on releases/* branches that get merged to “releases/* branch via pull requests. That way, multiple people can work on the epic tasks at the same time, meaning that there will be several sub-branches branched off of the releases/* branch.
- This allows us to Review the sides of the epic in much smaller phases that way, not a giant Pull Request is being reviewed at once.
- Once everything is good and merged onto releases/* branch, we merge the releases/* branch to master, which means that the Epic is completed, the changes are live.
Please take a look at the diagram below to get a visual understanding
Problems that we have with this approach:
When working in sub-branches based on releases/* branches, sometimes we need a change from another sub-branch at the same level, and we are constantly cherry-picking the changes we may need to be able to work with our own task. Is that the only approach, or is there a better approach for these?
We do not have branch protection on releases/* branches for CI tests.
- We are able to accidentally merge a Pull Request to releases/* branches from a sub-branch when the tests are failing. We tried adding branch protection to releases/* branches so that they are protected for CI tests being passed, however, once we enable this setting in Github, we are not able to do any “push” required actions to the releases/* branches, (rebasing with the master for pulling in a change we need that other teams implemented or doing a merge commits then pushing, etc.)
- From the Github’s branch protection setting for enabling status checks: "When enabled, commits must first be pushed to another branch, then merged or pushed directly to a branch that matches this rule after status checks have passed."
- This ^^ means that we can only create a pull request to retrieve any changes from the master branch to releases/* branches and rebase the sub-branches accordingly.
- We are able to accidentally merge a Pull Request to releases/* branches from a sub-branch when the tests are failing. We tried adding branch protection to releases/* branches so that they are protected for CI tests being passed, however, once we enable this setting in Github, we are not able to do any “push” required actions to the releases/* branches, (rebasing with the master for pulling in a change we need that other teams implemented or doing a merge commits then pushing, etc.)
Any recommendations?