Following the FAQ article “How to Rename the master branch to main in Git”, and the GitHub documentation itself, you can:
- rename your local branch from master to main:
git branch -m master main - push to main:
git push -u origin main - update your default branch on GitHub side:

- Then delete the remote master branch:
git push origin --delete master
Finally, as I documented in “How can I create a Git repository with the default branch name other than “master“?”, don’t forget a:
git config --global init.defaultBranch main
(See commit 32ba12d, with Git 2.28+, Q3 2020)
Your next new repositories will use the right branch name by default.