Interview Prep/Git & GitHub/Governance, migration, automation and cost

How do you move a large org from `master` to `main` safely?

IntermediateProductionGovernance, migration, automation and cost
Answer

Rename through the GitHub UI or API, which redirects and retargets open PRs, then update CI triggers, deployment configs, badges and protection. Search the org for hardcoded branch names before the change and announce a cut-over date with a one-liner for local clones.

gh api -X POST repos/ORG/REPO/branches/master/rename -f new_name=main
git branch -m master main && git fetch && git branch -u origin/main main
All Git & GitHub questions Roadmap: Git & GitHub

More on Governance, migration, automation and cost