How to rename git default branch
There have been suggestions to rename the default branch in the ClusterLabs projects' git repositories. "main" is a common suggestion for a new name (and the current default used by newly created repositories on Github). Other suggestions include names that indicate how the project uses the branch, for example "stable" or "next".
If the default branch of an existing project is renamed, anyone who has an existing fork and/or checkout of the repository will have a dangling reference to the old name. This document describes how to fix those.
Rename default branch in a fork
If you have a Github fork of a project whose default branch was renamed, do this from one checkout of your fork (replace "master" with the old name and "main" with the new name, if different):
git branch -m master main git push -u origin main # Now go to the github page for your fork, select Settings then Branches, # and change the default branch to main. Then continue below ... git push origin --delete master git remote set-head origin -a
If you have more than one checkout of your fork, repeat the first and last commands from the above in each one.
Rename default branch in a checkout
If you only have checkouts (not a fork) of the upstream repository, you can update each one like this (replace "master" with the old name and "main" with the new name, if different):
git fetch --all git remote set-head origin -a git branch --set-upstream-to origin/main git branch -m master main