Skip to content

Instantly share code, notes, and snippets.

@benigumocom
Last active February 11, 2023 05:03
Show Gist options
  • Select an option

  • Save benigumocom/876dda63f16be441fb36204973e1cb5c to your computer and use it in GitHub Desktop.

Select an option

Save benigumocom/876dda63f16be441fb36204973e1cb5c to your computer and use it in GitHub Desktop.
Rename Git branch master to main
git status
# On branch master
# Your branch is up to date with 'origin/master'.
#
# nothing to commit, working tree clean
git branch -a
# * master
# remotes/origin/HEAD -> origin/master
# remotes/origin/master
git branch -m master main
git push -u origin main
# To https://github.com/your/project
# * [new branch] main -> main
# branch 'main' set up to track 'origin/main'.
## Switch default branch on GitHub Site
git push origin :master
# To https://github.com/your/project
# - [deleted] master
git remote set-head -a origin
# origin/HEAD set to main
git branch -a
# * main
# remotes/origin/HEAD -> origin/main
# remotes/origin/main
@benigumocom
Copy link
Copy Markdown
Author

benigumocom commented Feb 7, 2023

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