Samvera Community Wiki
Effectiveness of Tool: Branch Renaming Script - Samvera Branch Renaming Working Group
Setup
Create a test repo with a master branch, issues, PRs - See samvera-labs/branch-renaming-wg for a script to do this.
Within the test repo, create a wiki page that references a branch in master.
Create a Fork of the test repo.
Clone the test repo to your local machine
Tool: Renaming Script
Reference:
Renaming Script (GitHub gist)
Case Study:
https://github.com/kelynch/branch-renaming-test
Ran:
# set up test repo at ~/code/branch-renaming-test
git clone https://gist.githubusercontent.com/escowles/eed4567d818f77811311386df8e71133
# move the script and make it executable
mv eed4567d818f77811311386df8e71133/rename-master-to-main.sh ~/code/hold/rename.sh
cd ~/code/hold/
chmod 755 rename.sh
# export your GitHub token
echo $GITHUB_TOKEN=xyz
./rename.sh kelynch branch-renaming-test
git fetch
git branch -d master
# remote branch cannot be deleted before protection rules are updatedChecklist:
Locations text "master" still exists (mostly found via github search):
Links to code outside this repository
Issues and PRs made to master before renaming
Integrations
Forks
Documentation
Evaluation:
This script provides a quick and easy interface to replace "master" with "main" on a GitHub repository and update the local to "main." It is intentionally conservative in its approach and does not delete branches on the local or remote, so all removal of "master" should be done manually. This script may be especially useful when used with GitHub's upcoming seamless transition tooling.