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

prepare to rename default branch to main #3462

Merged
merged 1 commit into from
May 12, 2021
Merged

Conversation

minrk
Copy link
Member

@minrk minrk commented May 11, 2021

  • update references to default branch name in docs, workflows
  • use HEAD in github urls, which always works regardless of default branch name
  • fix petstore URLs since the old petstore links seem to have stopped working

to merge, in order:

  • approve this PR
  • rename the default branch to main in settings
  • merge this PR

Related tangent: I've been using this git default-branch to help with my aliases and friends working with repos with different branch names.

- update references to default branch name in docs, workflows
- use HEAD in github urls, which always works regardless of default branch name
- fix petstore URLs since the old petstore links seem to have stopped working
@betatim
Copy link
Member

betatim commented May 11, 2021

The diff looks good to me. I think the "risk" of merging this is that there are occurrences of master left that aren't shown in the diff (because we missed them). I did a grep --exclude-dir=node_modules --exclude-dir=share/jupyterhub/static -R "master" * on this PR and didn't find any more occurrences.

There will be stuff we miss but the quickest way to find it will be to make the switch and then clean up as we go along (I think).

Took a quick look at https://github.com/minrk/git-stuff/blob/main/bin/git-default-branch but not quite sure what it does. Is it a helper script to switch my local checkout (and my fork) to main? Asked differently: is there a guide/a few lines of commands we can post to help people switch over their local checkouts and forks?

@minrk
Copy link
Member Author

minrk commented May 11, 2021

not quite sure what it does

It just returns the name of the default branch, i.e. master now, main soon (git default-branch -f to refresh the cache when a given repo changes its default).

The idea is wherever you would type 'master' or 'main', which assumes you know what the default branch is, you put $(git default-branch) instead, which will always be right. I admit that's a bit tedious to type all the way out, but ~all of the times I would type this I actually use one of my most-used aliases, updated here:

alias m='git checkout $(git default-branch)'
alias mp='git checkout $(git default-branch) && git pull'
alias rebase='git rebase -i origin/$(git default-branch)'

so I don't have to change anything I actually type into the terminal based on the repo's default branch.

is there a guide/a few lines of commands we can post to help people switch over their local checkouts and forks?

GitHub's own docs have this:

$ git branch -m OLD-BRANCH-NAME NEW-BRANCH-NAME
$ git fetch origin
$ git branch -u origin/NEW-BRANCH-NAME NEW-BRANCH-NAME
$ git remote set-head origin -a

Having more detailed instructions is hard because there are so many ways to use git (e.g. upstream=canonical, origin=my fork vs my personal preference: origin=canonical, mine=my fork). Covering them all doesn't seem feasible to me.

and forks?

and forks is interesting: I've never used the default branch on a fork. That doesn't make a lot of sense to me, so I don't feel like there's anything to do there. You can have your own fork's default branch be whatever you like, and it should be unaffected by the default branch of this repo.

@minrk minrk merged commit 6be3160 into jupyterhub:main May 12, 2021
@minrk minrk deleted the master-main branch May 12, 2021 09:00
minrk added a commit to minrk/jupyterhub that referenced this pull request May 12, 2021
- update references to default branch name in docs, workflows
- use HEAD in github urls, which always works regardless of default branch name
- fix petstore URLs since the old petstore links seem to have stopped working

to merge, in order:

- [x] approve this PR
- [x] rename the default branch to main in settings
- [x] merge this PR

Related tangent: I've been using [this git default-branch](https://github.com/minrk/git-stuff/blob/main/bin/git-default-branch) to help with my aliases and friends working with repos with different branch names.

Signed-off-by: Min RK <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants