跳至主要内容

在拉取请求中删除和恢复分支

如果您在仓库中拥有写入权限,您可以删除与已关闭或已合并的拉取请求关联的分支。您不能删除与打开的拉取请求关联的分支。

删除用于拉取请求的分支

如果拉取请求已合并或关闭,且没有其他打开的拉取请求引用该分支,您可以删除与该拉取请求关联的分支。有关关闭不与拉取请求关联的分支的信息,请参阅 在仓库中创建和删除分支

  1. 在 GitHub 上,导航至仓库的主页面。

  2. 在仓库名称下,点击 拉取请求

    Screenshot of the main page of a repository. In the horizontal navigation bar, a tab, labeled "Pull requests," is outlined in dark orange.

  3. 要查看已关闭的拉取请求列表,请点击 已关闭

    Screenshot of the "Pull requests" page for a repository. The "Closed" filter shows a checkmark icon and "31 closed". It is outlined in orange.

  4. 在拉取请求列表中,点击与您想删除的分支关联的拉取请求。

  5. 在拉取请求底部附近,点击 删除分支

    如果该分支当前有打开的拉取请求,此按钮将不显示。

恢复已删除的分支

您可以恢复已关闭拉取请求的头分支。

  1. 在 GitHub 上,导航至仓库的主页面。

  2. 在仓库名称下,点击 拉取请求

    Screenshot of the main page of a repository. In the horizontal navigation bar, a tab, labeled "Pull requests," is outlined in dark orange.

  3. 要查看已关闭的拉取请求列表,请点击 已关闭

    Screenshot of the "Pull requests" page for a repository. The "Closed" filter shows a checkmark icon and "31 closed". It is outlined in orange.

  4. 在拉取请求列表中,点击与您想恢复的分支关联的拉取请求。

  5. 在拉取请求底部附近,点击 恢复分支

延伸阅读

© . This site is unofficial and not affiliated with GitHub, Inc.