I have two realms - a “dev” realm and a “prod” realm. I have configured the CI so that pushes to the the “main” branch deploy to “dev”, and pushes to the “prod” branch deploy to “prod”. So far so good.
I’d like the commits on these two branches to stay in sync. For example, if the latest commits on the main branch are A, B, C, D, and E. The production branch should have the same commits, but optionally it might be behind the main branch, so production might have commits C, D, and E.
We get into trouble when people who are not familiar with Git create PR’s to merge main to prod, which rewrites the commits, or create commits with merge bubbles, which then create commits that only exist on the production branch.
I turned on branch protection, which prevents force pushes to either main or prod branches, in the hopes of requiring a linear history, and preventing merge commits from being pushed. But it doesn’t seem to prevent the issues that I’ve been seeing with people on my team.
Right now I am asking folks to just use the command line to do:
git checkout prod
git merge --ff-only main
git push origin prod
to deploy to prod. Are there automated tools or merge strategies I can deploy to help protect/encourage this workflow?
I suppose I could create a bot that handles production deploys, but that seems like a lot of work.