Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Rename default branch from "master" to "main" #6476

@Morgy93

Description

@Morgy93

DDEV contributors, we've renamed the "master" branch to "main" in the ddev/ddev repo. You can optionally rename the default branch in your fork, and we recommend updating any "master" links you may be using. Of course, it's usually far better not to use "master" or even "main" in your fork. Use an appropriately named branch for your change instead, for example 20250107_username_my_feature_description

Image


Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem?

History:

The computer industry's use of the terms master and slave caught everyone's attention in the summer of 2020. Amid the many protests and the growing social unrest, these harmful and antiquated terms were no longer considered appropriate.

"Both Conservancy and the Git project are aware that the initial branch name, 'master,' is offensive to some people and we empathize with those hurt by the use of that term," said the Software Freedom Conservancy.

GitHub took action based on the Conservancy's suggestion and moved away from the term master when a Git repository is initialized, "We support and encourage projects to switch to branch names that are meaningful and inclusive, and we'll be adding features to Git to make it even easier to use a different default for new projects." As a result, GitHub renamed the master branch to main branch.

Source: https://www.theserverside.com/feature/Why-GitHub-renamed-its-master-branch-to-main

Following this inclusive thought, I'd like DDEV to rename the branch master to main as well.

Describe your solution

Taking example from microsoft/vscode#116341 we could prepare a PR for renaming inside the repo code.

Announcing the change for some weeks as a pinned issue (like the VSCode one) and in Discord.

After merging the PR, one needs to rename the branch in GitHub, which will do the rest like:

  • Re-target any open pull requests
  • Update any draft releases based on the branch
  • Move any branch protection rules that explicitly reference the old name
  • Update the branch used to build GitHub Pages, if applicable
  • Show a notice to repository contributors, maintainers, and admins on the repository homepage with instructions to update local copies of the repository
  • Show a notice to contributors who git push to the old branch
  • Redirect web requests for the old branch name to the new branch name
  • Return a "Moved Permanently" response in API requests for the old branch name
image

Source: https://github.com/github/renaming?tab=readme-ov-file#renaming-existing-branches

That's all for this repo. But:

Afterwards, people need to run locally:

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

I think that's easy to announce and use as a copy paste answer if people are asking for it.

Describe alternatives

No response

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions