How to delete git master


First you delete master in your local clone. To do this we first make a new branch called placeholder or similar, and delete master from there:

All good so far. We next want to delete the branch on github. However, if we do this the naive way:

we just get an error like this:

That is because github is looking at the master branch to provide the web content when you browse that repository. So we first have to make github look at our placeholder branch instead, then delete master.

First push up the placeholder branch:

Then set placeholder to be the github default branch. Go to the main github page for your forked repository, and click on the “Admin” button.

There’s a “Default branch” dropdown list near the top of the screen. From there, select placeholder. On the interface I’m looking at, a green tick appears above the dropdown list. Now you can do (from the command line):

and – no master branch…