Why GitHub renamed its master branch to main | TheServerSide (2024)

Feature

Article 1 of 4

Part of:Cultural change in development

The GitHub master branch is no more. Developers used to think it was untouchable, but that's not the case. Here's why GitHub made the switch from master branch to main branch.

Since its inception, the Git DVCS tool's default branch name was set to master. Every Git repository had a master branch unless a developer took explicit steps to remove it, which was rarely ever done because the master branch plays an integral role in the software development world. For most projects, the master branch represents the source of truth -- that is, all the code that works, is tested and ready to be pushed to production.

However, the term master is out of favor in the computing world and beyond. Git and GitHub weren't far behind either. Starting October 1, all new GitHub repositories will create a default branch named main, and GitHub will no longer create a master branch for you. Let's examine why GitHub renamed the master branch to main branch and what effect it will have on developers.

Cultural sensitivity

The computer industry's use of the terms master and slave caught everyone's attention in the summer of 2020. Amid the many protests and the growing social unrest, these harmful and antiquated terms were no longer considered appropriate.

"Both Conservancy and the Git project are aware that the initial branch name, 'master,' is offensive to some people and we empathize with those hurt by the use of that term," said the Software Freedom Conservancy.

GitHub took action based on the Conservancy's suggestion and moved away from the term master when a Git repository is initialized, "We support and encourage projects to switch to branch names that are meaningful and inclusive, and we'll be adding features to Git to make it even easier to use a different default for new projects." As a result, GitHub renamed the master branch to main branch.

Why GitHub renamed its master branch to main | TheServerSide (2)

In practice, there's never been anything special about Git's master branch. However, the branch is so ubiquitous that users often believe that it can't be deleted or removed from a project without harming the repository. These are false assumptions. The master branch is no different than any other branch in a cloned Git repo, except that historically it's been the default name used when the first branch is created. A developer can delete, rename and even re-create the master branch after it's deleted, just like any other Git branch.

The GitHub switch from master to main

The change isn't retroactive and won't affect any existing projects. Also, if GitHub users want to add a branch named master to their repository, there is nothing to stop them. GitHub only discourages the term -- it does not ban the term.

Important DevOps tools

Of course, any project hosted on GitHub that expects a master branch to exist will run into problems. For example, if a developer creates a new repository with GitHub's own Jekyll-based website hosting tool GitHub Pages, it's still configured to look for static content on a master branch that doesn't exist.

However, this will soon be updated. All attempts to access GitHub Pages on a newly created repository will fail until a developer changes the settings so it serves Pages from the main branch instead of master. It's easy to fix, but it also serves as a reminder that there may be some unexpected blips as GitHub renames its master branch.

It's a one-time engineering cost that will have lasting impacts.

One researcher says the change will do little to alter projects, and there will be next to no effect on his research group's workflow.

"I really appreciate the name change [because] it raises awareness," said Javier Cánovas, assistant professor in the SOM Research Lab, at the Internet Interdisciplinary Institute at the Open University of Catalonia in Barcelona. "There are things that we accept as implicit, and we then realize that we can change them because they don't match our society."

For Whitney Sorenson, chief architect at HubSpot in Cambridge, Mass., the benefits of GitHub renaming the master branch to main far outweigh any temporary stumbling blocks. He said the change is part of a broader internal initiative to add inclusive language to the company's systems. His team is also replacing whitelist and blacklist with allowlist and blocklist.

"While it takes time to make these changes now, it's a one-time engineering cost that will have lasting impacts, both internally and externally," Sorenson said in an email. "We're in this for the long game, and we know inclusive language is just as much about how we code and what we build as it is about person-to-person interactions."

Cameron McKenzie also contributed to this report.

Next Steps

GitHub hires first-ever chief security officer

How to create a GitHub repository

Dig Deeper on DevOps-driven, cloud-native app development

  • How to use the git remote add origin commandBy: CameronMcKenzie
  • Git branch rename: Command to change a branch name in GitBy: CameronMcKenzie
  • How to git clone a specific commitBy: CameronMcKenzie
  • How to delete all Git branches except master or main exampleBy: CameronMcKenzie

Part of: Cultural change in development

Article 1 of 4

Up Next

Why GitHub renamed its master branch to mainThe GitHub master branch is no more. Developers used to think it was untouchable, but that's not the case. Here's why GitHub made the switch from master branch to main branch.
Master-slave terminology alternatives you can use right nowSoftware companies have found alternatives for master-slave terminology to describe their distributed systems. It's time for the rest of the IT world to do the same.
Incorporate diversity and inclusion in technology designDEI in technology is about more than creating a diverse workplace. We talked to a few DEI professionals about how teams build tools with diversity and inclusion in mind.
How developers can help build a diversified workforceDiversity comes in many forms. One way to diversify your workforce is to find new applications for the unique skills developers bring to your organization.
Why GitHub renamed its master branch to main | TheServerSide (2024)
Top Articles
Latest Posts
Article information

Author: Ms. Lucile Johns

Last Updated:

Views: 6318

Rating: 4 / 5 (41 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Ms. Lucile Johns

Birthday: 1999-11-16

Address: Suite 237 56046 Walsh Coves, West Enid, VT 46557

Phone: +59115435987187

Job: Education Supervisor

Hobby: Genealogy, Stone skipping, Skydiving, Nordic skating, Couponing, Coloring, Gardening

Introduction: My name is Ms. Lucile Johns, I am a successful, friendly, friendly, homely, adventurous, handsome, delightful person who loves writing and wants to share my knowledge and understanding with you.