My main branch
Over the last few months, the web community has been vying to move away from "master/slave" terminology. I (as well as many others) have started addressing this in my own work been replacing master
branches with main
, including this site. You can also do this easily with the following two commands:
git branch -m master main
git push -u origin main
This will keep all of your history, but under a main
branch. Tools like GitHub can automatically make main
your default branch as well.
Setting main as your initial branch
On July 27, 2020, version 2.28.0 of Git was released with a new configuration option named init.defaultBranch
that allows you to set your initial branch instead of it being hardset to master
. You can set this configuration with the following line:
git config --global init.defaultBranch main
Now any time you run git init
, the repo will be instantiated with a main
branch.