Last active
February 11, 2023 05:03
-
-
Save benigumocom/876dda63f16be441fb36204973e1cb5c to your computer and use it in GitHub Desktop.
Rename Git branch master to main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rename Git branch master to main
๐ https://android.benigumo.com/20230207/replace-git-branch-master-to-main/