Skip to content
This repository was archived by the owner on Sep 25, 2025. It is now read-only.
This repository was archived by the owner on Sep 25, 2025. It is now read-only.

Rename default branch from master to main #434

Closed

Description

@Ryuno-Ki

Discuss your ideas or share your views:

I just noticed this while debugging another PR. The default branch is called master.
This year, as a result of BLM, GitHub moved the default branch from „master” to something more neutral („main”).

This issue is about

  • giving some history context,
  • discussing, whether this project should follow along (not all repo owners do) and
  • what will be needed if we do so.

History

Back in June, GitHub announced to move the default branch later this year citing associations to Slave-Mastery.
The changes were implemented in October this year.

That caused discussions on the git mailing list, where the actual background was stated:

Git doesn't use "master-slave" terminology -- the "master" comes from
the concept of having a "master" from which copies (branches) are made:

https://simple.wikipedia.org/wiki/Master_recording

The concept predates the music business and goes back to middle ages
when a guild master would create a "master work" or "master piece" that
the apprentices could use for study or for imitation.

https://en.wikipedia.org/wiki/Master_craftsman

So, while I wholeheartedly support using inclusive language, I think git
is in the clear here.

There is a draft at IETF to update terminology, too.

However, a few projects switched their terminology way earlier:

Or already migrated / are in the process of migration (note: this also deals with other problematic terms):

As you can see, a lot is going on to ban racist terms in software.

Should this repo follow along?

Personally, I'd say yes.
To me, „master” is a technical term. I don't associate it with slavery (but more with craftmanship). But it's a small change, which doesn't do much harm (rather a one-off for existing forks) and can help more people feel welcome.
That's why I'd argue it's worth it.

What's needed to change?

You can change

Tech Republic says:

  • Open pull requests must be targeted to the newly named branch;
  • draft releases must be targeted to the newly named branch; and
  • branch protection policies must be transferred to the newly named branch.

GitHub's intention is to ensure that, by the end of the year, all repositories will be able to seamlessly rename their default branch. That means when you rename a branch, GitHub will automatically retarget open pull requests and draft releases and move your branch protection policies. GitHub is also hoping to be able to redirect users who use either git fetch or git clone to move an old branch name to a new branch name.

First thing you should do locally is BACKUP.
Then, move your local master to main: git branch -m master main.
Push it to GitHub: git push -u origin main
Update your HEAD: git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
If your default branch was updated, you can delete the master branch on GitHub: git push origin --delete master (or git push origin :master).

Find more information on GitHub's support page on renaming.

Activity

  1. naomi-lgbt commented on Nov 7, 2020

    @naomi-lgbt
    Member

    Dropping by to say that I believe GitHub will be rolling out an automatic rename at some point - and that we will also want to consider this discussion for the other freeCodeCamp repositories, in my opinion.

  2. allella commented on Nov 7, 2020

    @allella
    Contributor

    I don't have a problem with it, but I think someone should review our docs, Docker, tooling, and other configuration to see if master is used and have a plan for updating all of these as part of a PR instead of simply changing the name and potentially causing breaking changes or confusion in the docs.

    For instance, CONTRIBUTING.md has many references to master.

    Also, if we do this, would we need to close all PRs against master so they aren't against an old branch?

  3. naomi-lgbt commented on Nov 7, 2020

    @naomi-lgbt
    Member

    Also, if we do this, would we need to close all PRs against master so they aren't against an old branch?

    If GitHub doesn't automatically update that when (if?) we push the manual rename, PRs can be changed to target a different branch through the GitHub UI 🙂

  4. Ryuno-Ki commented on Nov 7, 2020

    @Ryuno-Ki
    ContributorAuthor

    @allella Since 2016 you can change the branch of a PR via the GitHub UI.

  5. Ryuno-Ki commented on Nov 7, 2020

    @Ryuno-Ki
    ContributorAuthor

    someone should review our docs, Docker, tooling, and other configuration to see if master is used

    Right. Don't forget Crowdin translations.
    Do we want to turn this into a „meta“ ticket (I can add a checklist in the initial post) or handle it as a project for a repo?
    Who's gonna search the mentioned resources (could be several $SOMEONEs in my opinion)?

  6. naomi-lgbt commented on Nov 7, 2020

    @naomi-lgbt
    Member

    I would propose making it a meta ticket - primarily because it wouldn't make sense to change the branch on this repository but not on the others.

  7. Ryuno-Ki commented on Nov 7, 2020

    @Ryuno-Ki
    ContributorAuthor

    It's not only on the branch renaming (will change the issue title once we agree upon having this as meta-ticket).

  8. naomi-lgbt commented on Nov 7, 2020

    @naomi-lgbt
    Member

    True, though using the meta ticket to track the changes needed for each repository is an option (and something I have seen done in the past)

  9. ojeytonwilliams commented on Nov 9, 2020

    @ojeytonwilliams
    Contributor

    Just to check: you're discussing creating an issue to track this for all repositories on freeCodeCamp/freeCodeCamp? I think that's the way to go. As Nicholas said, this is something we'd want to do globally - having non-standard default branches just causes confusion.

  10. added
    Roadmap
    on Nov 9, 2020
  11. vkWeb commented on Nov 9, 2020

    @vkWeb
    Member

    @Ryuno-Ki we should wait by the end of this year / early Q1 next year as GitHub has planned to release some automation for branch renaming.

    For existing repositories, renaming the default branch today causes a set of challenges:

    • Open pull requests need to be retargeted to the new branch
    • Draft releases need to be retargeted to the new branch
    • Branch protection policies need to be transferred to the new branch

    By the end of the year, we'll make it seamless for existing repositories to rename their default branch. When you rename the branch, we’ll retarget your open PRs and draft releases, move your branch protection policies, and more - all automatically. And, we’re also looking into redirecting users who git fetch or git clone the old branch name to the new branch name (with a warning and instructions to update their local clone), so it’s easy for your contributors to move.

    Extracted from: https://github.com/github/renaming#later-this-year-seamless-move-for-existing-repositories-

  12. Ryuno-Ki commented on Nov 9, 2020

    @Ryuno-Ki
    ContributorAuthor

    True, though using the meta ticket to track the changes needed for each repository is an option (and something I have seen done in the past)

    I imagined a ticket with a checklist in the first post.
    PRs addressing checklist item will mention this issue. Once they get merged, the checklist item gets ticked (manually).

    That's my understanding of a meta ticket.
    You could also create a new project and assign labels to the issues to track it this way.

    Just to check: you're discussing creating an issue to track this for all repositories on freeCodeCamp/freeCodeCamp?

    Originally not, since that would cross the boundaries of this repo.
    That's why I asked, whether we should track it in a Kanban board on https://github.com/freeCodeCamp level.

    As Nicholas said, this is something we'd want to do globally - having non-standard default branches just causes confusion.

    I agree.

    @Ryuno-Ki we should wait by the end of this year / early Q1 next year as GitHub has planned to release some automation for branch renaming.

    You could prep PRs for documentation updates, though.

    Extracted from: https://github.com/github/renaming#later-this-year-seamless-move-for-existing-repositories-

    Also mentioned towards the end of my initial post :-)

    @nhcarrigan Thanks for opening up another issue over at freeCodeCamp/freeCodeCamp!

  13. naomi-lgbt commented on Nov 9, 2020

    @naomi-lgbt
    Member

    Glad to help! Though I ended up closing it as duplicate of Quincy's issue: freeCodeCamp/freeCodeCamp#39098

  14. allella commented on Mar 13, 2021

    @allella
    Contributor

    @nhcarrigan does fCC have a plan for when GitHub or fCC will switch the default branch.

    Not a big deal, but wanted to see if we need to update docs or plan for a change at some point soon.

  15. naomi-lgbt commented on Mar 13, 2021

    @naomi-lgbt
    Member

    I'm not sure when GitHub plans on automatically renaming branches, or if they still do. We have it on our roadmap to do it manually at some point, but it's not something we are necessarily rushing.

    That being said, if you all would like to get ahead of the automation and change it manually, I'm more than happy to assist with that process.

  16. allella commented on Mar 14, 2021

    @allella
    Contributor
  17. allella commented on Mar 14, 2021

    @allella
    Contributor

    At least these two files would need to be updated

    CONTRIBUTING.md
    scripts/pullUpstream.sh

  18. NorthDecoder commented on Mar 14, 2021

    @NorthDecoder
    Contributor

    I would vote yes for a default branch name of develop !

  19. allella commented on Mar 18, 2021

    @allella
    Contributor

    The default branch and the name of the master / main seem to be two different decisions.

    Of course, having develop and main/master is a common pattern for isolating the development work from the stable / live branch.

    I believe the intention of this issue was renaming master to main.

    If we also want to switch the docs and default branch to develop in the same process, then I'd go along with it too. However, I am curious if changing the default would cause problems, like if someone unknowning cloned the project expecting to get a stable branch and ended up in development. If there are issues like that, then the tags and documentation can likely work around them.

  20. removed
    Roadmap
    on May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions