I used Fish shell because it's my favorite.
hub make small things more efficient but you could just as easily
ls and open the GitHub URL some other way. I tend to organize projects by putting everything in a "Code" directory
so these scripts are meant to iterate over a bunch of project sub-directories (which may or may not be git repos).
The first script iterates over all sub-directories of the current working directory, creates local & remote
branches derived from master, then opens the GitHub home page for the project. From there, you can select Settings >
Branches and change the default branch to main.
You run the second script after making the change on GitHub, which unprotects the previous default branch, so now you can delete and prune it. I did find that one repo, in addition to using it as a default branch, also had an entry under Branch protection rules which protected the "master" branch and needed to be removed.
One final note: another way you cannot delete a branch is if there are any open pull requests hanging off it. So it would be best to merge or close all PRs first, then proceed with the steps above.