Blog Home RSS Kelvin Jackson

Yes, You _Can_ Delete 'master' in Git


If you were wondering, it is in fact possible to delete the master branch in a Git repo. There isn't even anything special to it — you just use git branch -d after switching to a different branch, as usual.

Do bear in mind, though, that I have only tested this in an empty repo, and there might be negative consequences that would only arise in a full-blow production repo. If you choose to do this, you do it at your own risk. Don't mess around with important branches in a production repo unless you're certain that you have everything backed up, and will be able to recover your work even in the event of a bug that appears several hundred commits down the road.

Whether you actually should delete master is a question beyond the scope of this blog — a full treatment of it, let alone an answer, would require far more research than simply messing around with Git does. All I will say here is that you should be extremely wary lest you make a change like this and then use it as an excuse to pat yourself on the back for performative antiracism.