Skip to content

Instantly share code, notes, and snippets.

@maroda
Last active June 26, 2020 18:22
Show Gist options
  • Save maroda/15ead8b01999fead0866dc8e7e88fa36 to your computer and use it in GitHub Desktop.
Save maroda/15ead8b01999fead0866dc8e7e88fa36 to your computer and use it in GitHub Desktop.
Change GitHub default "Master" branch to "Main"

For those who would like to change the default master branch in GitHub to something else, here using main instead:

  1. Make sure you're up-to-date: git checkout master; git fetch; git pull
  2. Rename the branch: git branch -m main
  3. Push the change: git push -u origin main
  4. No PR is needed
  5. In the GitHub UI for the REPO being changed: Settings → Branches → Default branch
  6. Select main from the drop-down menu, click Update
  7. Browse to https://github.com/USER/REPO/branches
  8. Click the red trashcan next to master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment