Skip to main content

Creating and deleting branches within your repository

You can create or delete branches directly on GitHub AE.

Creating a branch

You can create a branch in different ways on GitHub AE.

Note: You can only create a branch in a repository to which you have push access.

Creating a branch using the branch dropdown

  1. 在 your enterprise 上,导航到存储库的主页。
  2. Optionally, if you want to create the new branch from a branch other than the default branch of the repository, click Branches then choose another branch. Branches link on overview page
  3. Click the branch selector menu. branch selector menu
  4. Type a unique name for your new branch, then select Create branch. branch creation text box

Deleting a branch

您可让头部分支在仓库中的拉取请求合并后自动删除。 有关详细信息,请参阅“管理分支的自动删除”。

Note: If the branch you want to delete is the repository's default branch, you must choose a new default branch before deleting the branch. For more information, see "Changing the default branch."

If the branch you want to delete is associated with an open pull request, you must merge or close the pull request before deleting the branch. For more information, see "Merging a pull request" or "Closing a pull request."

  1. 在 your enterprise 上,导航到存储库的主页。
  2. 在文件列表上方,单击 “分支”。 概述页面上的分支链接
  3. Scroll to the branch that you want to delete, then click . delete the branch

如果您在拉取请求合并后删除头部分支,GitHub 会检查将已删除分支指定为基础分支的同一仓库中的任何开放拉取请求。 GitHub 将自动更新任何此类拉取请求,将其基础分支更改为合并的拉取请求的基础分支。 For more information, see "About branches."

Further reading