Here’s my issue. We have a master branch “main” that all MRs have to be merged to to be deployed. Before any MR can be merged to “main”, they must be approved by multiple peers, which can take awhile. We then hit merge, which does a squash-and-merge. It fails…a lot. Let me explain:
The procedure for creating a feature branch MR is to:
- Pull main
- create branch called ‘feature_branch’
- do work
- merge latest main into ‘feature_branch’ locally
- push ‘feature_branch’
- create the MR
In the time it can take to get an approval, however, “main” might change. So when you go to merge, the squash fails. There is not merge conflict, but it is likely some history conflict. It doesn’t really matter, because if you re-merge main into your branch and push, the problem is resolved. However, you’ll then need multiple approvals again. What if that takes hours and you get out of date again? We have 20 engineers contributing to the same repo, I’ve been caught in this cycle 3 or more times. It’s a massive time suck.
My solution: ask gitlab, when you press the merge button, to merge main to the feature branch first. That way, barring an actual merge conflict, everything should go smoothly.
I tried googling how to this but it’s a tricky query. Anyone able to point me to documentation on how to do it?