Skip to content

Instantly share code, notes, and snippets.

@abidanBrito
Last active February 5, 2022 15:11
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 abidanBrito/d4465ba9b71efe554f72e120b16d5d0f to your computer and use it in GitHub Desktop.
Save abidanBrito/d4465ba9b71efe554f72e120b16d5d0f to your computer and use it in GitHub Desktop.

I sometimes run into issues when setting up a local repo because of the new main default branch name on GitHub. Let's rename the local branch and set its upstream properly.

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a

NOTE: git remote set-head origin -a fetches and sets origin/HEAD, so that the local repository has a local reference of what the remote repository considers to be the default branch.

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