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

Move master branch to main #1480

Closed
jennybc opened this issue Sep 8, 2021 · 3 comments
Closed

Move master branch to main #1480

jennybc opened this issue Sep 8, 2021 · 3 comments

Comments

@jennybc
Copy link
Member

jennybc commented Sep 8, 2021

The master branch of this repository will soon be renamed to main, as part of a coordinated change across several GitHub organizations (including, but not limited to: tidyverse, r-lib, tidymodels, and sol-eng). We anticipate this will happen by the end of September 2021.

That will be preceded by a release of the usethis package, which will gain some functionality around detecting and adapting to a renamed default branch. There will also be a blog post at the time of this master --> main change.

The purpose of this issue is to:

  • Help us firm up the list of targetted repositories
  • Make sure all maintainers are aware of what's coming
  • Give us an issue to close when the job is done
  • Give us a place to put advice for collaborators re: how to adapt

message id: euphoric_snowdog

@jennybc
Copy link
Member Author

jennybc commented Sep 29, 2021

GitHub's support for default branch renaming means that, in general, pull requests that target the default branch will be correctly re-targetted.

However, there are some edge cases, where this is not true. Some pull requests are automatically closed when the default branch is renamed and they cannot be re-opened. This happens when the PR-making branch, fork, or user no longer exists. (Literally, it appears to boil down to whether HEAD of the PR branch is available for whatever behind-the-scenes magic is happening.)

There is 1 open pull request in this repo that is at risk of auto-closing:

#1420

A way to "rescue" the work on such a PR is described in isaacs/github#168 (comment). Here's the TL;DR:

If there is a PR displaying unknown repository after the fork was deleted, and you want to resurrect that PR, simply type:

git fetch origin refs/pull/123/head:foo

substituting (if necessary) origin for the remote pointing at the target repo, 123 for the PR number, and foo for the name of the local branch you want created to point to the head of the PR.

Then you can simply git checkout foo ... and resubmit a new one ....

message id: hardhearted_newt

@jennybc
Copy link
Member Author

jennybc commented Oct 28, 2021

The at-risk PR has been merged already.

@jennybc
Copy link
Member Author

jennybc commented Oct 28, 2021

I have moved the default branch from master to main here (and elsewhere)!

When I ran usethis::git_default_branch_rename(), I saw this output, which might require some follow-up:

✓ Default branch of the source repo 'r-lib/usethis' has moved: 'master' --> 'main'
• Be sure to update files that refer to the default branch by name.
  Consider searching within your project for 'master'.
x Some badges may refer to the old default branch 'master':
  - 'README.Rmd'

As a result, I won't close this issue, but rest assured that the default branch has been renamed.

This blog post announces the larger effort and explains how contributors can update their local environments:

Renaming the default branch

Here's the TL;DR:

  1. Update usethis (you want usethis v2.1.2 or higher):
    install.packages("usethis")
  2. Anyone with an existing fork or clone can adjust to the renamed default branch with:
    usethis::git_default_branch_rediscover()
    If you wish, you can read the documentation for git_default_branch_rediscover().
    Or do the command line equivalent (see the blog post).

message id: goofy_chipmunk

@jennybc jennybc removed the wip work in progress label Oct 28, 2021
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

No branches or pull requests

1 participant