Interview Prep/Git & GitHub/Branching and workflow design

How do you support multiple released versions (1.x, 2.x, 3.x) without chaos?

AdvancedProductionBranching and workflow design
Answer

Keep main as the single place for new work, cut release/N.M branches when a version ships, and require every fix to land on main first and then be cherry-picked with -x to each supported branch. Automate the back-port with labels (backport release/2.x) using a bot or an Action so it is not a manual chore, and publish a support policy so nobody back-ports to dead versions. Tag each release from its branch, never from main.

git switch release/2.x
git cherry-pick -x <fix-sha>
git tag -s v2.4.1 -m "2.4.1" && git push origin release/2.x v2.4.1
All Git & GitHub questions Roadmap: Git & GitHub

More on Branching and workflow design