Renaming git’s default branch
Here’s how to change git’s default branch for new projects to the name “main” to avoid unpleasant language. This will eventually become the default.
Run this code once in a shell. This will persist a change in your .gitconfig file.
git config --global init.defaultBranch main
To rename existing branches on a local repo it’s as simple as
git branch -m master main
Updating a remote branch name is a little more complicated.