Since October 2020, Github made change about naming master branch to main branch as default when you create a repository.
So how about the existing repository and you want to change to main branch as default.
Here is how to do it in three steps.
# Step 1 # create main branch locally, taking the history from master git branch -m master main # Step 2 git fetch origin # Step 3 git branch -u origin/main main
Check the git status.
# git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean
Done, now you have synced to main branch.