Update a local repo for when an origin’s primary branch changes from master to main
git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a
Source: Github popup when you use their UI to make the change.