DOI-USGS / meddle

Tools for metadata creation and data releases
Other
0 stars 10 forks source link

NOTICE: upcoming default branch name change #77

Closed jesse-ross closed 2 years ago

jesse-ross commented 2 years ago

The master branch of this repository will soon be renamed from master to main, as part of a coordinated change across the USGS-R organization. This is part of a broader effort across the git community to use more inclusive language. For instance, git, GitHub, and GitLab have all changed or are in the process of changing their default branch name.

We anticipate this will happen early in the week of December 13, 2021. The purpose of this issue is to give notification of the change and provide information on how to make it go smoothly.

If you wish to make the change yourself, it can either be done manually or through some convenience functions in the usethis package.

Using usethis

Note: usethis must be version 2.1.2 or higher

  1. Run usethis::git_default_branch_rename()

The screen shot below shows the output of this command in addition to a few other commands. For more details see here.

image

Note that if you have not yet set up git credentials for HTTPS, you can do so by creating a GitHub PAT and using gitcreds::gitcreds_set() to register it with git.

image

Manual Method

  1. Go to -> Settings -> Branches and edit the default branch from master to main.
  2. All members must update their local settings to match this change. They can either do this with usethis::git_default_branch_rediscover (see above) or else run the following:
    git branch -m master main
    git fetch origin
    git branch -u origin/main main
    git remote set-head origin -a
jordansread commented 2 years ago

This was pretty quick

usethis::git_default_branch_rename()
✓ Setting active project to '/Users/jread/Documents/R/meddle'
Error: Pull request functions can't work with GitHub remote configuration: 'maybe_fork'
The most likely problem is that we aren't discovering your GitHub personal access token
Call `gh_token_help()` for help
* Host = 'https://github.com'
* origin = 'jread-usgs/meddle' = fork of 'USGS-R/meddle'
* upstream = 'USGS-R/meddle'
* Both 'origin' and 'upstream' appear to be GitHub repos. However, we can't confirm their relationship to each other (e.g., fork and fork parent) or your permissions (e.g. push access).

We may be offline or you may need to configure a GitHub personal access
token. `gh_token_help()` can help with that.

Read more about what this GitHub remote configurations means at:
'https://happygitwithr.com/common-remote-setups.html'

then

usethis::gh_token_help()
• GitHub host: 'https://github.com'
• Personal access token for 'https://github.com': <unset>
• To create a personal access token, call `create_github_token()`
• To store a token for current and future use, call `gitcreds::gitcreds_set()`
ℹ Read more in the 'Managing Git(Hub) Credentials' article:
  https://usethis.r-lib.org/articles/articles/git-credentials.html

usethis::create_github_token()
• Call `gitcreds::gitcreds_set()` to register this token in the local Git credential store
  It is also a great idea to store this token in any password-management software that you use
✓ Opening URL 'https://github.com/settings/tokens/new?scopes=repo,user,gist,workflow&description=DESCRIBE THE TOKEN\'S USE CASE'

and followed Jesse's gitcreds::gitcreds_set() instructions after the online token prompt. I used a 30 day expiring token

image 🎉