Skip to content

Instantly share code, notes, and snippets.

@emmahsax
Last active November 24, 2020 21:37
Show Gist options
  • Save emmahsax/090cca9e87128b7b2bd9c1d6344efde4 to your computer and use it in GitHub Desktop.
Save emmahsax/090cca9e87128b7b2bd9c1d6344efde4 to your computer and use it in GitHub Desktop.
A guide of how to switch from master to main branch in the terminal

Switching from master Branch to main Branch

From the terminal, run this:

git checkout master
git branch -m master main
git fetch
git branch --unset-upstream
git branch -u origin/main
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main

Every person who has the repository cloned on their local machine will have to run:

git pull
git checkout main
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
git branch -D master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment