Created
July 29, 2020 06:05
-
-
Save alecthegeek/639827ac6972152a42d98599dfb94fea to your computer and use it in GitHub Desktop.
Move branches names on a local repo and push change to the remote. Defaults master -> main
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
#!/bin/bash | |
oldb="${1:-master}" | |
newb="${2:-main}" | |
git pull --all | |
git checkout $oldb | |
git branch -m $oldb $newb | |
git push -u origin $newb | |
read -p "from the GitHub repo settings change the default branch to $newb. Press any key when done" x | |
git push origin --delete $oldb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment