Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The primary branch has been renamed from "master" to "main" #21767

Closed
bvaughn opened this issue Jun 29, 2021 · 4 comments
Closed

The primary branch has been renamed from "master" to "main" #21767

bvaughn opened this issue Jun 29, 2021 · 4 comments
Labels
React Core Team Opened by a member of the React Core Team

Comments

@bvaughn
Copy link
Contributor

bvaughn commented Jun 29, 2021

Renaming master branch to main

As a part of a broad effort to avoid problematic terminology in our software, we are renaming our default branch from master to main. We recognize that this is only a small step, but it is an opportunity to make our project and community more welcoming to historically marginalized communities.

How does this impact my development process?

There should be very little impact. GitHub will surface the branch name change in your fork, if you have one. For new forks, you will automatically have main as the default branch.

We encourage the use of feature branches for local development. The only change in practice is changing which branch your feature branch is started from. When sending Pull Requests on GitHub, the target will default to our main branch, so there are no changes to make there.

I have a lot of tools that depend on master being the upstream branch name. How can I fix that?

master has always been only a default value and a number of projects have used other names for their primary development branch for years. We encourage updating your tooling to instead dynamically determine the branch to use. This article provides insight into how you can do that. Additionally, you can always set up a branch locally of any name to track our main branch.

I'd like to do this for my own projects, do you have any documentation on how this works?

GitHub has published a guide documenting their tooling. We recommend reading that and the accompanying documentation.

If you're a Facebook employee looking to do this for a project you maintain, please reach out to the Open Source Team.

My PR is failing because of ci/circleci: get_base_build

This is because the master branch has been renamed to main, but our Circle CI scripts used to refer to master by name. To fix this, just rebase your branch on top of main to get the latest version of the Circle CI scripts:

git fetch origin
git rebase -i origin/main
@bvaughn
Copy link
Contributor Author

bvaughn commented Jun 29, 2021

In case it is helpful for others, ere is a list of steps I have taken for this transition:

@bvaughn
Copy link
Contributor Author

bvaughn commented Jun 29, 2021

Need to follow up on why d483463 triggered a failed deployment of the scheduling profiler:
https://app.circleci.com/pipelines/github/facebook/react/15233/workflows/77f4dd14-e1ed-43cf-9979-b5a5f4c15976/jobs/334771

Not sure why this would fail, as Vercel is configured to support either main or master (if there's no main).

Based on this page, I think I might need to get someone from the Facebook org to approve the connection of facebook/react with Vercel so that I can update the branch name in the Project Settings > Git page. cc @zpao for any insight here.

Re-ran again and it passed:
https://app.circleci.com/pipelines/github/facebook/react/15233/workflows/77f4dd14-e1ed-43cf-9979-b5a5f4c15976/jobs/334873

@bvaughn
Copy link
Contributor Author

bvaughn commented Jun 29, 2021

Note that, unfortunately, it seems like existing PRs might be broken by this change after all– until they rebase on main– because of our Circle CI scripts which refer to "master" explicitly.

Ideally we would have auto-detected the primary branch in these scripts (e.g. git remote show origin | sed -n '/HEAD branch/s/.*: //p') so they would just switch over automatically. I didn't think to do that prior to flipping the switch though, so we'll just have to make the best of it now. At least it's a one time pain, easily remedied.

For now, I've added a section to the issue above with the Circle CI task that fails and how to fix it (by rebasing).


Edit: Looks like this is working okay for pre-existing PRs, e.g. #21766

@bvaughn bvaughn changed the title Renaming master branch to main The primary branch has been renamed from "master" to "main" Jun 29, 2021
@bvaughn bvaughn added the React Core Team Opened by a member of the React Core Team label Jun 29, 2021
@gaearon
Copy link
Collaborator

gaearon commented Sep 6, 2021

We can probably close this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

No branches or pull requests

2 participants