git rename master to main
$ git branch -m master main
git rename master to main
$ git branch -m master main
How can i rename my local master branch to main ?
$ git branch -m master main
how to rename git branch fro master to main
# Step 1
# create main branch locally, taking the history from master
git branch -m master main
# Step 2
# push the new local main branch to the remote repo (GitHub)
git push -u origin main
# Step 3
# switch the current HEAD to the main branch
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
# Step 4
# change the default branch on GitHub to main
# https://docs.github.com/en/github/administering-a-repository/setting-the-default-branch
# Step 5
# delete the master branch on the remote
git push origin --delete master
rename branch to main
$ git push -u origin main
rename branch to main
$ git push origin --delete master
rename master to main
// must already have added somethign to HEAD
$ git branch -m master main
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us