Skip to content

Instantly share code, notes, and snippets.

@williamrowell
Last active November 27, 2021 04:58
Show Gist options
  • Save williamrowell/e7a5433d3099c9db80dad48ff0b84679 to your computer and use it in GitHub Desktop.
Save williamrowell/e7a5433d3099c9db80dad48ff0b84679 to your computer and use it in GitHub Desktop.
change default branch from master to main
  1. Move the ‘master’ branch to ‘main’
git branch -m master main
  1. Push ‘main’ to remote repo
git push -u origin main
  1. Point HEAD to ‘main’ branch
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
  1. Change default branch to ‘main’ on GitHub site, "settings" -> "branches"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment