Tired of remembering to rename the master branch after running git init? This option will help you!
Okay, so we're starting to standardize on
main as the default branch. Super!
My gut says Git will update to some other default branch sometime soon or make you choose. But, for the time being, the default is still
You may seen the solution that you can run this command on an existing repo to rename
$ git branch -m main
That's all well and good and not that painful, but it's still another thing to remember when starting a new project.
But, now Git has a newer config option available in which you can set the default branch on the
init command for your machine:
$ git config --global init.defaultBranch main
You need to be on a newer version of Git for this to work. See here for determining if you have the option available. If you don't and the command doesn't work for you, you likely have to upgrade Git. Here's a nice guide on how to do that on Mac.
And now every time you run
git init, the branch Git will provide you will be
GitHub is super awesome, until you have to start paying for it. Check out two feature-full and FREE alternatives.