Rename master branch to main on all Plone repositories

Hello all,

During its March 18th meeting, the Plone Foundation Board formalized the decision to rename existing repositories branch names from master to main. The name of the default branch for new repositories is already set to main.

As we are a large organization with hundreds of repositories, the renaming must be done in an automated way, so the AI Team will handle the renaming using a script leveraging Github API.

We already checked this automation via API behaves, in the same way, as the UI option and will take care of:

  • Re-target any open pull requests
  • Update any draft releases based on the branch
  • Move any branch protection rules that explicitly reference the old name
  • Update the branch used to build GitHub Pages, if applicable
  • Show a notice to repository contributors, maintainers, and admins on the repository homepage with instructions to update local copies of the repository
  • Show a notice to contributors who git push to the old branch
  • Redirect web requests for the old branch name to the new branch name
  • Return a "Moved Permanently" response in API requests for the old branch name

But, as of now, it will not:

  • Modify the default branch on your local clones
  • Modify existing automation scripts (Travis, Github workflow)
  • Modify references within buildout files or requirements.txt files
  • Update our Jenkins configurations

We will use this topic to plan the next steps, discuss risks and agree on a timeline to proceed with the renaming.

Please let us know your ideas/suggestions/concerns.

Érico Andrei


I used all-repos successfully to mass apply changes for the Zope and morepath repositories.

I have recorded this testrun for a lightning talk and I also wrote a blog post at How to create hundreds of pull requests with a single command? — Jürgen Gmach and some quick tips at til/all-repos at master · jugmac00/til · GitHub

I am happy to answer any question if possible.

Basically you need to identify the places where changes need to happen and a safe regex to target them.

1 Like

Awesome!!! Can't wait to get our hands dirty to make this happen!

1 Like

Just curious, what is the reason for renaming?

For background, read Why GitHub renamed its master branch to main.

I did this manually for the three Pylons Projects repos I maintain because I do not want to inadvertently offend anyone. The other Pylons Project maintainers are watching Plone to see how its automation works for them.

1 Like

I was aware of the change GitHub proposed a while ago. I don't mind the rename on its own. But I do think it is for the wrong reason. Renaming master to main won't make the history go away. Besides, it is introducing group guilt which is just absurd. I am afraid it is very dangerous: not the renaming, but the ideology behind it.

1 Like

Obviously history cannot be erased. What's done is done. That's not the reason to do this.

If the branch were named stevepiercys_race_is_inferior_and_subservient_and_we_choose_to_perpetuate_the_connotation_by_doing_nothing, I would appreciate the renaming to main.

Being a member of privileged group, I have never lived what others outside that group have experienced. Doing nothing to end it has the same result as perpetuating it.


CPython just did the renaming and faced some problems (already solved by GitHub staff)

1 Like

Oh well... Pablo streamed the release of Python 3.10b1 and the renaming live, and it made boooom :dizzy_face:

Luckily, there was a Microsoft employee in the stream, so he could reach out to GitHub on the "fast" way :slight_smile:

Well, Pablo stayed super cool and it worked out eventually - after fixing some more problems with buildbot.

Btw... cpython put some documentation out there for the developers, too.

So maybe it is a good idea, to also tell all plone devs how to update their local repositories, cf 32. Git Bootcamp and Cheat Sheet — Python Developer's Guide


Here is the link to the one moment Pablo won't forget anytime soon :smiley: