6/14/2020 Administrator

Changing The Git Default Branch from Master to Main


As Scott Hanselman points out in his blog post:

The Internet Engineering Task Force (IETF) points out that "Master-slave is an oppressive metaphor that will and should never become fully detached from history" as well as "In addition to being inappropriate and arcane, the master-slave metaphor is both technically and historically inaccurate.

You may not agree with this, but since Blazor-Blogs is *my* project we are 100% Black Lives Matter, and we are making the change Smile

image

The first step was to open the GitHub connected project in Visual Studio.

image

Select Tools, then Command Line, then Developer Command Prompt.

image

Following the directions from Scott’s Blog, enter:

git branch -m master main

image

Then enter:

git push -u origin main

image

The system with think for a moment then display a link and suggest I make a pull request.

I don’t need to do this.

image

I go to the site on GitHub and I now see I have 2 branches.

I click on the branches link to navigate to them.

image

I see that I now have a main branch, and a master branch that is the Default branch and a button to change it.

image

I can then switch the Default branch from master to main.

image

Yes, I understand making this change makes me a bleeding heart liberal… Smile

image

I can now return to the main page of the GitHub repository and click on the branches link again.

image

The main branch is now the Default branch.

I can click the delete button to remove the old master branch.

An error has occurred. This application may no longer respond until reloaded. Reload 🗙