This version of GitHub Enterprise will be discontinued on This version of GitHub Enterprise was discontinued on 2020-08-20. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.

Article version: Enterprise Server 2.18

Setting the default branch

If you have more than one branch in your repository, you can choose another branch to be the default branch.

In this article

About the default branch

When you create a repository on GitHub with content, the repository is initialized with a single branch, called the default branch. The default branch is the base branch in your repository, against which all pull requests and code commits are automatically made, unless you specify a different branch. If you have more than one branch in your repository, anyone with admin rights over a repository can select one of these existing branches as the default branch on the repository.

Setting the default branch

Note: To set the default branch you must have more than one branch in your repository.

  1. On GitHub Enterprise, navigate to the main page of the repository.
  2. Under your repository name, click Settings.
    Repository settings button
  3. In the left menu, click Branches.
    Repository options sub-menu
  4. In the default branch drop-down, choose the new default branch.
    Default branch dropdown selector
  5. Click Update.

You can only switch between branches that already exist on your GitHub Enterprise Server instance. To create a new branch through the UI, see "Creating and deleting branches within your repository".

Warning: Setting a different default branch affects your trunk branch contents on the Git-Subversion bridge and the HEAD you'd see when you git ls-remote this repository's upstream URL.

Ask a human

Can't find what you're looking for?

Contact us