Git: Change Master Branch to Main Branch


The racial interactions that have taken place in the United States during 2020 have prompted a number of changes to take place. Calls for police reform, better diversity training, and calling out "Karens" for their actions are just a few movements in this strive for social justice.

In the technology space, there are certain terms that are common place to describe certain things.

Some examples are

  • "whitelist" - approval of a list of items, commonly used with firewall rules
  • "blacklist" - denial of a list of items, commonly used with firewall rules
  • "master" - primary branch in a Git repository; primary drive in a computer
  • "slave" - the non-primary drive(s) in a computer

Since "master" has connections to slavery, and such term can be used in a derogatory nature, a number of technology users, including myself decided to stop using the "master" branch as the primary and change it to something more netural, such as "main". In this video, I talk about how you can do the same for your repositories.

Video Tutorial

Commands used are below the video.


Below are the commands used in the video.

git branch -m master main

git status

git push origin main

git push -d origin master

git branch -a
Updated: 2021-03-10 | Posted: 2020-09-15
Author: Kenny Robinson