You can rename a branch in a repository on GitHub. For more information about branches, see "About branches."
If you rename a branch, GitHub will automatically redirect links on GitHub.com that contain the old branch name to the equivalent link on the renamed branch. GitHub will also update branch protection policies, as well as the base branch for open pull requests and draft releases.
- On GitHub, navigate to the main page of the repository.
- Above the list of files, click NUMBER branches.
- In the list of branches, to the right of the branch you want to rename, click .
- Type a new name for the branch.
- Review the information about local environments, then click Rename branch.
After you rename a branch in a repository on GitHub, any collaborator with a local clone of the repository will need to update the clone.
From the local clone of the repository on a computer, run the following commands to update the name of the default branch.
$ git branch -m OLD-BRANCH-NAME NEW-BRANCH-NAME $ git fetch origin $ git branch -u origin/NEW-BRANCH-NAME NEW-BRANCH-NAME