Skip to content

Instantly share code, notes, and snippets.

@diversemix
Created June 15, 2020 10:42
Show Gist options
  • Save diversemix/eea486a9d680d64b319e924cb4bd4572 to your computer and use it in GitHub Desktop.
Save diversemix/eea486a9d680d64b319e924cb4bd4572 to your computer and use it in GitHub Desktop.
Local script to rename master branch to main
#!/bin/bash
git checkout master
git pull
git branch -m master main
git push -u origin main
git checkout main
echo "Go to the repo Settings > Branches > Default Branch. Change it to the new branch press [ENTER]"
read finished
git branch -d master # delete local master
git push --delete origin master # delete remote master
git remote prune origin # delete the remote tracking branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment