how to switch master to main code example
Example 1: change master to main git
$ git branch -m master main
Example 2: how to move master branch to main branch
git branch -m master main
git push -u origin main
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
git push origin --delete master
Example 3: how to switch from master to main
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
Example 4: how to switch from master to main
Steps
Step 1 – Move the master branch to 'main'
Step 2 – Push 'main' to remote repo.
Step 3 – Point HEAD to 'main' branch.
Step 4 – Change default branch to 'main' on GitHub site.
Step 5 – Delete 'master' branch on the remote repo.