Repository navigation
Rename default branch from master to main #434
Description
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: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.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:
- Django (2014)
- Drupal (2014)
- Roslyn (2017, .NET compiler)
- Python (2018)
- Redis (2018)
- Chromium (2019)
- PostgreSQL (2019)
- Jenkins (2019)
Or already migrated / are in the process of migration (note: this also deals with other problematic terms):
- Microsoft and IBM
- RedHat
- MySQL
- OpenBSD
- git
- Android OpenSource Project
- Go
- PHPUnit
- cURL
- OpenZFS
- OpenSSL
- Ansible
- PowerShell
- p5.js
- Circuit Python
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
- your personal settings and
- freeCodeCamp org settings (org admin permission required?)
- 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
naomi-lgbt commentedon Nov 7, 2020
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.
allella commentedon Nov 7, 2020
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?
naomi-lgbt commentedon Nov 7, 2020
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 🙂
Ryuno-Ki commentedon Nov 7, 2020
@allella Since 2016 you can change the branch of a PR via the GitHub UI.
Ryuno-Ki commentedon Nov 7, 2020
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)?
naomi-lgbt commentedon Nov 7, 2020
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.
Ryuno-Ki commentedon Nov 7, 2020
It's not only on the branch renaming (will change the issue title once we agree upon having this as meta-ticket).
naomi-lgbt commentedon Nov 7, 2020
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)
ojeytonwilliams commentedon Nov 9, 2020
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.
vkWeb commentedon Nov 9, 2020
@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.
Extracted from: https://github.com/github/renaming#later-this-year-seamless-move-for-existing-repositories-
Ryuno-Ki commentedon Nov 9, 2020
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.
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.
I agree.
You could prep PRs for documentation updates, though.
Also mentioned towards the end of my initial post :-)
@nhcarrigan Thanks for opening up another issue over at freeCodeCamp/freeCodeCamp!
naomi-lgbt commentedon Nov 9, 2020
Glad to help! Though I ended up closing it as duplicate of Quincy's issue: freeCodeCamp/freeCodeCamp#39098
allella commentedon Mar 13, 2021
@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.
naomi-lgbt commentedon Mar 13, 2021
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.
allella commentedon Mar 14, 2021
I can update the docs, but it would be good to have others chime in on if Docker or other parts of the app need to be updated.
For reference
https://github.com/github/renaming
https://docs.github.com/en/github/administering-a-repository/renaming-a-branch
allella commentedon Mar 14, 2021
At least these two files would need to be updated
NorthDecoder commentedon Mar 14, 2021
I would vote yes for a default branch name of
develop!allella commentedon Mar 18, 2021
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.