Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Changing the git default branch to main

Toshio Kuratomi edited this page Jul 2, 2020 · 10 revisions

This is just a scratchpad for now to hold the experiences of those who have made this transition

Potential instructions

Please update this section with any tested steps that are either simpler or handle more cornercases

Update the repository on GitHub

Create the new branch and push it to GitHub:

git clone [email protected]:organization/repo
cd repo
git branch -m master main   # Move the master branch to the main branch locally
git push -u origin main   # Set the origin to track upstream's main branch

Once this is done, the clone in the repo/ directory will have the main branch. Other local clones will need to use git

In the GitHub settings:

  • Go to GitHub settings and set the default branch to main via https://github.com/ansible-collections/REPONAME/settings/branches

  • Go to GitHub settings and change any branch protection rules for master to be for main instead. via via https://github.com/ansible-collections/REPONAME/settings/branches. If rules don't exist, create them:

    • Include administrators: Enabled
    • Require linear history: Enabled
  • Go to GitHub and retarget the open PRs from master to main

  • Go to GitHub and delete the master branch via https://github.com/ansible-collections/REPONAME/branches

  • Update any config that references the master branch. For instance, continuous integration configuration and deployment scripts may hardcode the branch name. An example for one project: https://github.com/ansible-community/antsibull/pull/100

Updating Shippable

(For Repos that use Shippable)

Updating codecov

GitHub Actions

Nothing Required

Zuul-CI

FIXME: Various things needed?

Updating a fork on GitHub

Someone please verify

If you have forked a repository on GitHub, you need to follow the same steps as for the main project's GitHub git repo in order to use main as well. This is less critical as you are less likely to have PRs against your fork but it still does nice things like defaults to main for the working copy when you clone a fresh local copy rather than defaulting to the obsolete and non-updated master branch.

Updating local clones

The fresh clone you made in the Github section will now be using main but what if you have other clones (or other contributors need to sync with your changes to the canonical repository)?

git checkout master
git branch -m master main
git fetch
git branch --unset-upstream
git branch -u origin/main
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main

(from https://twitter.com/xunit/status/1269881005877256192 )

(ARchived) Working groups

Working groups are now in the Ansible forum

Ansible project:
Community, Contributor Experience, Docs, News, Outreach, RelEng, Testing

Cloud:
AWS, Azure, CloudStack, Container, DigitalOcean, Docker, hcloud, Kubernetes, Linode, OpenStack, oVirt, Virt, VMware

Networking:
ACI, AVI, F5, Meraki, Network, NXOS

Ansible Developer Tools:
Ansible-developer-tools

Software:
Crypto, Foreman, GDrive, GitLab, Grafana, IPA, JBoss, MongoDB, MySQL, PostgreSQL, RabbitMQ, Zabbix

System:
AIX, BSD, HP-UX, macOS, Remote Management, Solaris, Windows

Security:
Security-Automation, Lockdown

Tooling:
AWX, Galaxy, Molecule

Communities

Modules:
unarchive, xml

Plugins:
httpapi

Wiki

Roles, Communication, Reviewing, Checklist, TODO

Clone this wiki locally