- Create a new branch locally from current
master
- call itmain
:
git checkout -b main
- Push the new branch to GitHub:
git push --force origin main
-
Go to GitHub project, go to settings, go to branches, switch default branch to
main
. -
Locally, do the following:
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
- Now you are ready to delete the local
master
, and the remotemaster
:
git branch -D master
git push origin --delete master