Create a new branch named main and push it to your remote.
git branch -m master main git push -u origin main
At this point, you may need to update your configuration on Github, or if you have tools that automatically deploy (Vercel, Netlify) to point to the main branch as your primary branch.
If you don't, you're likely to get an error like:
! [remote rejected] master (refusing to delete the current branch: refs/heads/master)
Then, delete the master branch:
git push origin --delete master
For your team
Your team will need to do some work as well:
$ git checkout master $ git branch -m master main $ git fetch $ git branch --unset-upstream $ git branch -u origin/main
- Switches you to your master branch
- Renames it to "main"
- Gets the latest branches
- Removes tracking with master
- Adds tracking with main