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

Rename the master branch #1421

Closed
ZoeBijl opened this issue Jun 8, 2020 · 19 comments · Fixed by #1779
Closed

Rename the master branch #1421

ZoeBijl opened this issue Jun 8, 2020 · 19 comments · Fixed by #1779
Assignees
Labels
enhancement Any addition or improvement that doesn't fix a code bug or prose inaccuracy Infrastructure Related to maintaining task force and repo operations, processes, systems, documentation

Comments

@ZoeBijl
Copy link
Contributor

ZoeBijl commented Jun 8, 2020

mastermain or masterprimary.

Resources:

@ZoeBijl ZoeBijl changed the title Rename the master branch to the main branch Rename the master branch Jun 8, 2020
@mcking65 mcking65 added enhancement Any addition or improvement that doesn't fix a code bug or prose inaccuracy Infrastructure Related to maintaining task force and repo operations, processes, systems, documentation labels Sep 2, 2020
@mcking65 mcking65 self-assigned this Sep 2, 2020
@mcking65
Copy link
Contributor

mcking65 commented Sep 2, 2020

We are first trying this in other ARIA repos where things are simpler. Following is an outline of a plan to execute. There are quite a few considerations, so I'm a little surprised there are not more articles out there about how to do it and how to avoid problems. Here is pplan we have at this time.

  1. Tell contributors when the default branch will be come main instead of master.
  2. create main branch from master.
  3. Update branch protection rules:
    1. Protect the new main branch with same rules that master has.
    2. Don't let people push to master by removing all teams from the list of people who can push to master. Note: it will apply to 0 branches after master is deleted, but should still prevent people from accidentally creating a new master.
  4. Set main as default branch.
  5. Delete master branch.
  6. Update build scripts to use main instead of master.
  7. Update open open pull requests to change base from master to main.
  8. Tell contributors to update their clones by:
    1. git fetch --prune
    2. git checkout main
    3. git branch -D master

Open questions:

  1. Does this create any problems for branches that were made from master?
  2. Is there a simple way to notify everyone who has forked or cloned?

@nschonni
Copy link
Contributor

nschonni commented Sep 2, 2020

1. Does this create any problems for branches that were made from master?

No, I don't think so, because under the hood, branches are just aliases to a commit hash, which will be the same for the new branch name. This suggests using the -m to move the branch though https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx

Reference for the PR target changing https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-base-branch-of-a-pull-request

Probably also need to update build status badges in README

Looks like GitHub also has something in the pipeline for this year, but no concrete date https://github.com/github/renaming#later-this-year-seamless-move-for-existing-repositories-

@mcking65
Copy link
Contributor

mcking65 commented Sep 4, 2020

@nschonni wrote:

Looks like GitHub also has something in the pipeline for this year, but no concrete date https://github.com/github/renaming#later-this-year-seamless-move-for-existing-repositories-

I was not aware. Thank you! I propose we wait for that process.

Most people seem to assume that people will open their clone and know that they first need to take some steps to do this ... but reality is most people will do a git pull without realizing the change was made. So, they will not have the option to use -m locally. It seems like the GitHub team is thinking about this too.

@nschonni
Copy link
Contributor

Seems like this might be ready now. I saw it in another repo doing it https://github.com/github/renaming#creating-a-seamless-move-for-existing-repositories-
There might be some code changes for things like badges and CI filters, but it looks like the PR aspect has been resolved

@jesdaigle
Copy link
Contributor

@mcking65 @nschonni Is there any communications that need to be done before this change is pushed up?

@nschonni
Copy link
Contributor

For the open PRs, I think it's transparent now, but it might be good to have a PR ready/open to adjust things like

@jongund
Copy link
Contributor

jongund commented Feb 24, 2021

@nschonni
What are the effects of this change on existing local branches?

@nschonni
Copy link
Contributor

@jongund I think you're talking about particular conflicts with branches on existing forks? If so, a branch is really a friendly name to a commit tree (probably not even explaining that right), so it's just getting a new label, rather than any changes to commits to the branch.
https://github.com/github/renaming#renaming-existing-branches talks a little, in that I don't think it's going to do any re-writes for you on your fork, so you might still want to create/rename yourself

A little off topic, but since these started to change, I adjusted my local git alias to be a little more agnostic to what the default branch is, like https://github.com/nschonni/dotfiles/blob/master/.gitconfig#L26

@jesdaigle
Copy link
Contributor

For the open PRs, I think it's transparent now, but it might be good to have a PR ready/open to adjust things like

@nschonni I have a branch with the required changes ready. However I got a "permission denied error" when I tried to push it. I am not certain of the process to get write access. Is there something I need to do?

@nschonni
Copy link
Contributor

I'm not a "member" of the group, so I just do everything from my fork and send PRs from there 😄

@jesdaigle
Copy link
Contributor

I'm not a "member" of the group, so I just do everything from my fork and send PRs from there 😄

Ha I will do it that way then!

@jesdaigle
Copy link
Contributor

PR: https://github.com/w3c/aria-practices/pull/1779/commits (thanks @nschonni )

@zcorpan
Copy link
Member

zcorpan commented Feb 24, 2021

(Edit: I see now this was already discussed above, sorry!)

GitHub now has a feature to make it easy to rename branches and automatically update existing PRs and branch protection settings. The steps are:

  1. Rename the branch to main as per https://docs.github.com/en/github/administering-a-repository/renaming-a-branch
  2. Merge Infrastructure: Update build and test process for default branch rename to main #1779
  3. Tell contributors to update their clones. GitHub UI already does this after a branch rename.

@mcking65
Copy link
Contributor

Thank you @jesdaigle and @zcorpan!

Here's what I propose for closing this out.

  1. We set a date and time at which @michael-n-cooper will rename master to main. I propose March 3, which is the day after the next task force meeting and the day of the next editor's meeting.
  2. I send an announcement to the public practices mailing list, and include instructions for clones.
  3. We include this on the March 2 APG task force meeting agenda.
  4. After Michael does the rename, I merge Infrastructure: Update build and test process for default branch rename to main #1779.
  5. I send a note to the public practices mailing list confirming that the rename has been completed and once again include instructions for clones.

The instructions for local clones are as follows.

From the local clone of the repository on a computer, run the following commands to update the name of the default branch.

git branch -m master main
git fetch origin
git branch -u origin/main main

After all this, what would be the best way to test to ensure everything is working correctly? I'd like to also ensure we have someone available to test and help resolve problems if any arise.

@mcking65
Copy link
Contributor

Rename time has been confirmed. The rename will occur between 10:00 and 11:00 AM US Pacific time on March 3, 2021.

@mcking65
Copy link
Contributor

@nschonni wrote:

I'm not a "member" of the group, so I just do everything from my fork and send PRs from there 😄

A lot of great PRs, I might add!

The downside of this is that is really difficult for anyone to contribute to the branch or rebase. So, it would be far better if you could branch in a clone instead of a fork.

@nschonni, I'm more than happy to add you to the team that can push new branches from a clone if you would like. I'd certainly like that.

@jesdaigle wrote:

Ha I will do it that way then!

@jesdaigle, like Simon, you are now a member of the ARIA contributors team and can push branches from a clone. Please make contributions that way going forward.

@jesdaigle
Copy link
Contributor

Thank you!

@carmacleod
Copy link
Contributor

carmacleod commented Feb 28, 2021

@nschonni wrote:

I'm not a "member" of the group, so I just do everything from my fork and send PRs from there 😄

@mcking65 wrote:

A lot of great PRs, I might add!

@carmacleod says:

+1, totally agree!

@nschonni
Copy link
Contributor

nschonni commented Mar 3, 2021

FYI, just sharing what I saw flipping over to my own fork now
image

The default branch on the parent repository has been renamed!
w3c/aria-practices renamed its default branch to main
You can rename this fork's default branch to match in branch settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any addition or improvement that doesn't fix a code bug or prose inaccuracy Infrastructure Related to maintaining task force and repo operations, processes, systems, documentation
Projects
None yet
7 participants