1
0
mirror of synced 2025-12-21 19:06:49 -05:00
Files
docs/content/github/administering-a-repository/managing-branches-in-your-repository/changing-the-default-branch.md
2021-06-24 11:02:53 -07:00

3.4 KiB

title, intro, permissions, versions, redirect_from, topics, shortTitle
title intro permissions versions redirect_from topics shortTitle
Changing the default branch If you have more than one branch in your repository, you can configure any branch as the default branch. People with admin permissions to a repository can change the default branch for the repository.
fpt ghes ghae
* * *
/github/administering-a-repository/setting-the-default-branch
/articles/setting-the-default-branch
/github/administering-a-repository/changing-the-default-branch
Repositories
Change the default branch

About changing the default branch

You can choose the default branch for a repository. The default branch is the base branch for pull requests and code commits. For more information about the default branch, see "About branches."

{% ifversion not ghae %} {% note %}

Note: If you use the Git-Subversion bridge, changing the default branch will affect your trunk branch contents and the HEAD you see when you list references for the remote repository. For more information, see "Support for Subversion clients" and git-ls-remote in the Git documentation.

{% endnote %} {% endif %}

{% ifversion fpt or ghes > 3.0 %}

You can also rename the default branch. For more information, see "Renaming a branch."

{% endif %}

{% ifversion fpt or ghes > 2.22 %}

{% data reusables.branches.set-default-branch %}

{% endif %}

Prerequisites

To change the default branch, your repository must have more than one branch. For more information, see "Creating and deleting branches within your repository."

Changing the default branch

{% ifversion fpt or ghes > 2.22 or ghae %}

{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.repository-branches %}

  1. Under "Default branch", to the right of the default branch name, click {% octicon "arrow-switch" aria-label="The switch icon with two arrows" %}. Switch icon with two arrows to the right of current default branch name
  2. Use the drop-down, then click a branch name. Drop-down to choose new default branch
  3. Click Update. "Update" button after choosing a new default branch
  4. Read the warning, then click I understand, update the default branch. "Update" button after choosing a new default branch

{% else %}

{% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.repository-branches %}

  1. In the default branch drop-down, choose the new default branch. Default branch dropdown selector
  2. Click Update.

{% endif %}