Last active
June 27, 2020 03:04
-
-
Save stuartsoft/9e2b5bd87e495447d7f47777d87d3d61 to your computer and use it in GitHub Desktop.
Replaces 'master' branch with 'main' branch for all projects in a desired directory
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 | |
#usage: $ ./rename-branch.sh ~/yourProjectsDirectory | |
cd $1 | |
folders=$(ls) | |
for f in $folders; do | |
cd $f | |
echo $f | |
git checkout -b main | |
git push --set-upstream origin main | |
git branch -d master | |
cd $1 | |
done | |
#This script uses the MIT License | |
#Copyright (c) 2020 Stuart Bowman | |
#https://choosealicense.com/licenses/mit/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment