Because of github changing the default branch from master to main all of my pushes end up in a separate branch instead of the main one and I can't change the default. When I start a program and make my first push, git tells me main doesn't exist and I always have to push to master instead.
Following the FAQ article " How to Rename the master branch to main in Git ", and the GitHub documentation itself , you can:
git branch -m master main
git push -u origin main
git push origin --delete master
Finally, as I documented in " How can I create a Git repository with the default branch name other than " master
"? ", don't forget a:
git config --global init.defaultBranch main
(See commit 32ba12d , with Git 2.28+, Q3 2020)
Your next new repositories will use the right branch name by default.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.