Skip to content

Convert your main development branch from master to main with ease

License

Notifications You must be signed in to change notification settings

hilary/mastertomain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

MasterToMain

MasterToMain is a script to help you change your branch name and all references from master to main.

Background

The master-slave metaphor is outdated and offensive and does not have a place in modern technology. Arguments have been made that the master branch references a master copy relationship, but evidence points to the contrary. In either case empathy is important and if changing one term is less harmful, let's do it.

Instructions

You may want to take a few minutes to clean up your repo before running mastertomain. We've done a fair bit of hardening against common situations (e.g., open pull requests), but a clean repo is a happy repo.

The script currently assumes that you are running it from a local clone of a git repo on ORIGIN. Copy this script into your local clone, and run it:

$ bash mastertomain.sh

What the script does, step by step:

  1. Automatically creates a new branch main
  2. Checks for any references to the word 'master'
    • If it finds references, provides an interactive interface to automatically update the references and commit any accepted changes.
  3. Prompts you to:
    1. update any branch protections
    2. update any open pull requests to use main as the base rather than master
    3. update external dependencies
    4. change your default branch from master to main on Github
  4. Finally, deletes master locally and at Github.

What if I want to call the branch something else?

To call the branch something else, use the environment variable MAIN: MAIN=dev bash mastertomain.sh

Additional Information

kapwing - does a great job of discussing the background. Their approach is different from ours, as they assume you don't have any tooling internal to the repo (github actions, travis, etc) which references master.

history of master in git - a collection of articles relating to the history of git and the use of the term master within it.

Authors

Created by Brandon Strittmatter and Hilary Holz

Acknowledgments

MasterToMain won the 2020 Q2 SharkaHack, DigitalOcean's quarterly internal hackathon. Thanks to DO for giving us the time to work on it!

About

Convert your main development branch from master to main with ease

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages