Skip to content

Instantly share code, notes, and snippets.

@sauterl
Last active August 30, 2021 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sauterl/7e0bb9099940f827e94fc4ad5c954621 to your computer and use it in GitHub Desktop.
Save sauterl/7e0bb9099940f827e94fc4ad5c954621 to your computer and use it in GitHub Desktop.
A quick guide to change from master as default branch to main

Git Master to Main Rename Followup

Prerequisite

Head over to your repo <ORGorUSER>/<REPO> and rename the default branch to main (this guide assumes, that previously, it was master).

https://github.com///settings/branches

Steps

Now, you have to locally set your HEAD to the newly renamed main (default) branch and get rid of your local master branch.

$> git fetch && git checkout main && git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main && git branch --delete master

Credits

Based on the official GitHub info and this lovely guide

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment