Header Image

It's About Time We Rename Our Git Repos' Primary Branches from Master to Main


 • 

Git historically used the term "master" for the primary branch. This master-slave metaphor, as pointed out by the Internet Engineering Task Force (IETF) is "an oppressive metaphor" and that it "should never become fully detached from history". They continue by saying that "In addition to being inappropriate and arcane, the master-slave metaphor is both technically and historically inaccurate."

The IETF also gives a list of different relationships that you can use instead of master-slave. These include:

  • Primary & secondary
  • Leader & follower
  • Active & standby
  • Primary & replica
  • Writer & reader
  • Coordinator & worker
  • Parent & helper

While they refer to these as alternatives, it is better to not call them alternative phrases to the master-slave connotation. The term alternative in and of itself leads to the presumption that whatever two or more objects you are comparing are equal in value. This would technically imply that primary-secondary for example, and master-slave, are equally valid, even when they are quite clearly not.

Regardless of personal preference, the "master-slave" connotation is one that a lot of people will not want to have to look at or deal with, given the historic meaning of the phrase.

Fortunately, renaming the "master" branch to something else is not really that difficult of a task. Since GitHub is using "main" as their replacement for "master", and since it would be good for muscle memory with the amount of people that do "ma [tab]", I willll use "main" in my example as well.

git branch -m master main
git push -u origin main

You will now have a new branch "main". You will also now need to set it as the default and remove the "master" branch. You will now want to update the default branch on GitHub by going to the repo you want to edit, tapping or clicking "settings", going to "branches", and following the on-page instructions for changing the default branch.

If you need to update local clones, you can do so with the below commands according to xunit.net:

git checkout master
git branch -m master main
git fetch
git branch --unset-upstream
git branch -u origin/main
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main

Hopefully the code provided here helps. If you do not want to use "main", you can always use branch names such as "latest", "development", and so on. Git is decentralized, and does not have requirements specifying what the default branch name needs to be.


Recent Posts:

Default image
(Why) You Should Not Use WordPress

Anton McClure • October 21, 2020

Technology; Internet; Alternatives; Security;

WordPress currently powers about 38% of the web, but there are better options with improved functionality, security, and more.

Oracle and TikTok logos. Oracle logo is a trademark of Oracle Corporation, and TikTok logo is a trademark of ByteDance.
Oracle Gets Chosen as TikTok's Secure Cloud Provider

Anton McClure • September 20, 2020

Oracle; Technology; Media; TikTok; Current Events;

Oracle Corporation (NYSE: ORCL) announced yesterday via twitter and their company blog that TikTok chose them to become their secure cloud technology provider in the US, through a decision heavily influenced by the recent success Zoom had after they moved a large portion of their video conferencing capacity to Oracle’s Public Cloud.

Background
We Need to Address These Preventable IoT Security Problems

Anton McClure • September 16, 2020

Technology; Cloud; Internet; Security;

According to the OWASP Internet of Things (IoT) top 10 vulnerabilities from 2018, that long ago, the top risk was weak, guessable, or hardcoded passwords. This, and other issues, are entirely preventable.

TikTok Logo - Property of ByteDance.
Trump Administration to Consider the ByteDance-Oracle TikTok Deal

Anton McClure • September 15, 2020

Oracle; Technology; Media; TikTok; Current Events;

According to CNBCs Jim Cramer, approval of Oracles deal for becoming a trusted technology partner for TikTok will be announced on Tuesday afternoon.