How to Update Repo Branch Name from “master” to “main”

  • Austin Aldrich
  • June 25, 2020

Due to recent events in America, we have started to evaluate some terms that are very readily used in the technology world. It is easy to become accustomed to a certain way of operating, but it is so important to take the action of evaluating what we do and what we say on a regular basis.

Bottom line: Words matter.

Words reflect our society’s and company’s beliefs about one another and reality… even outdated technical terms. “Master” has been used to describe the disk drive, code branch, server, or any other system where one entity serves a primary purpose. “Slave” has typically been used for one or many entities that exist to support the “master.” As an example, you might have a “master” hard drive, and one or more “slave” drives that copy whatever data is on master for the sake of redundancy.

In Git, there is no “slave,” but there is a “master” branch that really serves to house the production-ready state of an application’s code.

“Master” and “Slave” are not terms we promote in real life, so holding onto that same terminology in the digital world is antiquated and offensive. But we don’t have to wait until these language changes are adopted industry-wide across git and other repos.

Bonus bottom line: Actions matter, too.

We are now using the terms “main” in place of “master” and “replica” in place of “slave.” Moving forward, Airship will be transferring all of the projects over to the new nomenclature to reflect the values that we hold true to every day.

Here’s how we made the switch to our own repo branch name (in just 4 easy steps!) and how you and your organization can, too.

How to Update Repo Branch Name

Step 1

In your repo, change the branch name via:
git branch -m master main
git push -u origin main
git remote set-head origin main

Step 2

Update your remote to ensure it’s using “main” as the main/default branch:

Step 3

You’ll want to be sure you don’t have any pipelines that are reliant on your existing master branch before you delete it. Make sure to change those to “main.”

Some examples of this are CircleCI, BitBucket Pipelines, Heroku, and Visual Studio App Center.

App Center: You’ll want to clone an existing “master” build environment to the “main” branch via

Also, make sure if there are any open pull requests going to master, that those are updated to use “main” as the base branch.

Step 4

Finally, when you’re sure you want to delete master, run:

 git push --delete origin master


Be really sure you’ve got main pushed to remote and that no one else is still using “master.” This process deletes your “master” branch on your remote repo. It’s probably reversible depending on what code repository you’re using, but it’s best to treat the deletion as permanent.