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
More on Governance, migration, automation and cost
How do you migrate 200 repos from Bitbucket or GitLab to GitHub with minimal disruption?IntermediateWhat does a migration from SVN (or a legacy monolith repo) to Git need beyond the conversion?AdvancedWhat standard files should every repo have?BeginnerHow do you manage GitHub organisation settings as code?IntermediateWhat is InnerSource and how does Git workflow support it?IntermediateWhen do you use DCO versus CLA?Beginner