我们经常发布文档更新,此页面的翻译可能仍在进行中。有关最新信息,请访问英文文档。如果此页面上的翻译有问题,请告诉我们

设置默认分支

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

本文内容

Did this doc help you?

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.

设置默认分支

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

  1. 在 GitHub Enterprise 上,导航到仓库的主页面。
  2. 在仓库名称下,单击 Settings(设置)
    仓库设置按钮
  3. 在左侧菜单中,单击 Branches(分支)
    仓库选项子菜单
  4. In the default branch drop-down, choose the new default branch.
    默认分支下拉选择器
  5. Click Update.

您只能在 您的 GitHub Enterprise Server 实例 上已存在的分支之间切换。 要通过 UI 创建新分支,请参阅“创建和删除仓库中的分支”。

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.

Did this doc help you?