$ git branch -m master main$ git push origin main- Change "Default Branch" in Settings->Branches on github. https:github.com/your/repo/settings/branches.
- Accept any warnings about changing the default branch.
- If you have any branch protection rules that affect the
masterbranch, delete them. $ git push origin :master- If you had any branch protection rules affecting the
masterbranch, recreate them on themainbranch. - Look through your repo for references to
masterand replace withmainas necesary.- Examples of this include URLs to a file in the REPO that are not relative
- If you get a warning "Your branch is based on 'origin/master', but the upstream is gone." then use the command it recommends:
git branch --unset-upstream git addyour changes- `git commit -m "Rename master to main"
- Update any third party integrations that might be relying on the presence of the
masterbranch, such as codeclimate or various CI/CD systems
Last active
October 17, 2019 23:45
-
-
Save 0xdade/dbb18fb4a3866de18149efbb63277cab to your computer and use it in GitHub Desktop.
Changing default branches on github
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment