Change the name of your git repository’s default branch
1 min read Published by Lee Reamsnyder PermalinkSo this is a tiny thing all considered, but I’ll feel better about myself if I’m typing master
less often. These steps come from Scott Hanselman (via Jeremy Keith).
Move your master
branch to a branch with a different name (I’ve chosen main
):
git branch -m master main
Then push that up, updating the tracking branch in the process:
git push -u origin main
If you’re using Github, you can update the default branch on your repository by clicking Settings > Branches. Under the Default branch section, select “main” and click Update.
Netlify deploys this site whenever there’s an update to master
, so I had to change that. From the site dashboard, it’s Settings > Build & deploy. In the Deploy contexts section, click Edit settings, and update the Production branch and maybe the list in Branch deploys if you’ve selected Let me add individual branches. Then, click Save.
If you’re seeing this, it worked.