To change the default branch in a GitHub repository, you need admin access and at least two branches in the repo. docs.github
Via Web Interface
- Open your repository on GitHub.com (e.g.,
github.com/username/repo-name). docs.github - Click the Settings tab under the repo name (use the dropdown if not visible). docs.github
- In the left sidebar, find Branches > Default branch. docs.github
- Click the pencil icon or dropdown next to the current default branch name. docs.github
- Select your new default branch (e.g.,
main) from the list. docs.github - Click Update and confirm by selecting I understand, update the default branch. docs.github
This updates where new PRs and clones point by default. docs.github
Via GitHub CLI (Optional)
In your repo’s local directory:
gh repo edit --default-branch main
(Replace main with your target branch; it must exist first). stackoverflow
Let me know your setup (web-only, CLI, etc.) for more tailored steps.