Last active
June 28, 2022 20:38
-
-
Save DevoKun/f9d1653d16a91226c15b96f5f561432c to your computer and use it in GitHub Desktop.
Change GitHub Master branch name to Main
This file contains 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 pull # Pull first or lose ANY commits upstream | |
git branch -m master main # Rename branch locally | |
echo | |
echo "Change GitHub default branch to 'main'." | |
echo | |
echo "Is GitHub Default Branch 'main'?" | |
echo | |
read -p "Press ENTER to continue" | |
echo | |
git push origin :master # Delete the old branch | |
git push --set-upstream origin main # Push the new branch, set local branch to track the new remote |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment