Rename `master` branch to `main`
It's 2023 and it's usually a good practice to drop the name master in favour of something like main for the principal branch of the repository. Most repos I work with have done the switch (or are recent enough to be using main since their creation). Let's make this repo more user-friendly.
Technically I have the permissions to do this myself on the repo, but it requires a bit of sync between the different contributors, and probably some sync with whatever workflow runs on Netlify, so I really prefer to open an issue here instead.
@xmulligan we fully support the initiative to rename the principal branch to 'main' in line with current best practices. However, we currently do not have the necessary access rights to the repository settings to make this change.
If you could grant us the required access, we'd be happy to handle the renaming process. Alternatively, we can prepare everything on our side, and once we're set, you can switch the default branch to 'main'.
Please let us know how you'd prefer to proceed.
Sure, what access do you need?
Hey @xmulligan , we require Admin level access to be able to mess with repository settings and I doubt that's reasonable to ask at all.
Here is what I suggest:
- Here is the mirror to
masterbranch calledmain - You, or anyone with admin access follow this instruction and change default branch to
main - We update the target branch on Netlify and call it a day
⚠️ Of course, there is this caveat that existing PRs need to be retargeted afterwards, but that's not a big deal.
Wdyt?
Happy to apply step 2 whenever you're ready. Let's schedule a day and time so you can take a look immediately after the switch to update Netlify and ensure everything is still working? We could say tomorrow morning for example (I'm on UTC+00:00). Or later if you have another preference, just let me know.
As for the specific action for step 2: I think you linked to the wrong doc, the one you have is for setting the default name for the main branch on new repositories. Here we have two options:
- Either switch from
mastertomainthat you have created, following these steps - Or rename
masterintomain, following these steps instead. This option has the advantage to automatically update the existing pull requests:Branch protection policies are also updated, as well as the base branch for open pull requests (including those for forks) and draft releases.
I'd prefer option 2 to avoid breaking the existing PRs etc., however, this may conflict with the existing main branch that you have created. So here is what I plan to do, if you agree:
- Creating another copy of
masterandmain, saymaster-legacy - Then deleting the current
main - Then renaming
masterintomain, thus updating the open PRs
Let me know if this process sounds good to you, and let's confirm a time slot for the change.
How about planning this for next Monday? @bolotskydev
@bolotskydev or @americano98 can you still help with this?
@americano98 @bolotskydev any update here?
@americano98 @bolotskydev this is supposed to be quick, could any of you help please?
Hi @qmonnet, we have deleted the old main branch and added master-legacy as per your guide above. We do not have the rights to rename the master branch. Could you please rename master to main and contact us? We will then check that everything works correctly on Netlify and make any necessary adjustments
Hi @americano98, thanks a lot! I just renamed the branch, so you can check on your side now. :tada:
@qmonnet, thank you for your help and attention. We have updated the configuration, and now previews are built from the main branch🎉
Great to hear, thanks again!