Skip to content
This repository has been archived by the owner on Mar 4, 2023. It is now read-only.
/ no-more-masters Public archive

Rename your default Git branch from master to production

License

Notifications You must be signed in to change notification settings

gjtorikian/no-more-masters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

no-more-masters

Rename your default Git branch from master to main.

This script requires that you have a GitHub authorization token. As well, if you have branch protections enabled for master, consider turning them off so that the script can remove the branch from your remote repo.

Install

$ npm install -g no-more-masters

Usage

$ no-more-masters

OPTIONS
  -b, --branch=branch  [default: main] The branch name to create
  -h, --help           show CLI help
  -v, --version        show CLI version

What is this doing?

  1. git checkout -b main master: Create a branch main from master

  2. git push origin main: Push that main branch to your remote

  3. Using the GitHub API's Update a repository endpoint, set main as the new default branch

  4. git branch -D master: Removes master from your local machine

  5. git push origin :master: Removes master from your remote repository

    Note: this step will fail if branch protections are enabled

Configuration

If you have core.defaultBranch set, the script will use that branch name as its default.

A GitHub API token can also be provided via the GITHUB_TOKEN environment variable.

About

Rename your default Git branch from master to production

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •