Craft By Zen

Image from Boston University showing Today I learned
Image from Boston University showing Today I learned

📖 1 min read

🔖 TIL   git   programming

TIL how to rename my master branch to main

For my GitHub repo, I wanted to rename the remote master branch to main.

These instructions helped the process.

Go to Settings, then Branches, then edit the master branch. Rename them to main.

Renaming the default branch dialog
Renaming the default branch dialog

You will have to do it locally as well. The command for local machine is as follows.

git branch -m master main

Afterward, you may need to reattach main to origin/main. Follow the instructions on the terminal as necessary.

Why change to main?

This ZDNet article covers GitHub to replace “master” with alternative term to avoid slavery references. It took them awhile, so many of my old repos haven’t been updated accordingly.


Written by Jeremy Wong and published on .