gitRename master branch to main

Git commands to rename your master branch to main.

Rename branch locally

git branch -m master main

Push the new main branch to the remote

git push -u origin main

Remove the master branch on the remote

git push origin --delete master

If your master branch is the default on GitHub or another, you may not be able to remove it, you should first change the default or main branch and then try to remove it.