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

Changing the default branch to main #690

Closed
3 tasks done
joerick opened this issue May 23, 2021 · 5 comments · Fixed by #701
Closed
3 tasks done

Changing the default branch to main #690

joerick opened this issue May 23, 2021 · 5 comments · Fixed by #701

Comments

@joerick
Copy link
Contributor

joerick commented May 23, 2021

This is just a heads up, I'm planning to change the default branch on this repo to main this week, let's say Wednesday 26th. Github have a tool to change it over, and update PRs to target the new branch, but you might have to update it on local checkouts and forks. Shouldn't be a big issue though, this is what Github say about it:

Renaming a branch will:

  • 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

Checklist for the switch:

  • Use the Github tool to change it over
  • Find/replace master to main in CI configs, docs, scripts, example code, etc
  • Change default branch on Readthedocs
@pradyunsg
Copy link
Member

Experience from renaming pip's default branch is encoded here: pypa/pip#8948

Everything on GitHub "just works", but you'll need to manually update:

  • Any custom scripts.
  • non-GitHub CI configuration.
  • (maybe) CI commands and automation.
  • ReadTheDocs configuration.

@joerick
Copy link
Contributor Author

joerick commented May 23, 2021

Thanks @pradyunsg ! That's very helpful :)

@henryiii
Copy link
Contributor

One extra personal detail - remember to delete your master branches locally afterwards. I find it's important that 'git switch master` fail locally or otherwise I've started making PRs based on the old deleted master more than once. :/

@joerick
Copy link
Contributor Author

joerick commented May 27, 2021

The change has happened! Github is helpfully showing a note how to change your local repos, but if anyone missed it, the commands are:

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a

@henryiii
Copy link
Contributor

Interesting, if you follow those steps, local master goes away - ah, -m is move. Nice, that's helpful. Was going to recommend you also delete master but those instructions handle that - guess I should follow instructions instead of doing it manually from now on. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants