Skip to content

Instantly share code, notes, and snippets.

@maroda
maroda / maindefault.md
Last active June 26, 2020 18:22
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