Last active
March 15, 2024 12:36
-
-
Save ut/274c6473b50cc1227da5e782885d7ab6 to your computer and use it in GitHub Desktop.
How to get rid the old git default 'master' branch.
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
| # how to get rid the old git default 'master' branch | |
| # this is a variation from https://www.jumpingrivers.com/blog/git-moving-master-to-main/ | |
| # use this locally | |
| git fetch --all # update all remotes | |
| git checkout -b main # create new local branch main | |
| git push --set-upstream origin main # push new branch to remote | |
| git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main # set remote main as HEAD | |
| git branch -d master # delete local master | |
| git branch -rd origin/master # delete remote master ref | |
| (in moste cases that should be it and you can verify with git branch -a if on server-side everthing ist ok | |
| # optionally: at server | |
| git checkout master | |
| git branch -m main | |
| git symbolic-ref HEAD refs/heads/main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment