跳至主要内容

在 GitHub Desktop 中管理标签

您可以使用 GitHub Desktop 创建、推送和查看标签。

关于 GitHub Desktop 中的标签

GitHub Desktop 允许您创建带注释的标签。标签与提交相关联,因此您可以使用标签来标记存储库历史记录中的某个特定点,包括版本的版本号。有关发行版标签的更多信息,请参阅“关于发行版”。

默认情况下,GitHub Desktop 会将您创建的标签与关联的提交一起推送到您的存储库。

创建标签

  1. 在左侧边栏中,单击**历史记录**。

    Screenshot of the "History" tab in the sidebar. Above a list of commits, the tab button, labeled "History", is highlighted with an orange outline.

  2. 右键单击提交,然后单击**创建标签...**。

    Screenshot of a list of commits in the "History" tab. Next to a commit, in a context menu, the cursor hovers over the "Create Tag" option.

  3. 在“创建标签”对话框中,键入标签的名称。

  4. 单击**创建标签**。

查看标签

  1. 在左侧边栏中,单击**历史记录**。

    Screenshot of the "History" tab in the sidebar. Above a list of commits, the tab button, labeled "History", is highlighted with an orange outline.

  2. 单击提交。

    **注意**:如果标签尚未推送到远程存储库,GitHub Desktop 会显示一个箭头

    Screenshot of a list of commits in the "History" tab. Next to a commit, a "hello-tag" label and an "up arrow" icon are outlined in orange.

  3. 与提交关联的所有标签都将在该提交的元数据中可见。

    Screenshot of the detailed view of a commit. Above the commit's diff, in the commit's metadata, a tag icon and the label "hello-tag" are outlined in orange.

删除标签

**注意**:您只能删除与尚未推送的提交关联的标签。

  1. 在左侧边栏中,单击**历史记录**。

    Screenshot of the "History" tab in the sidebar. Above a list of commits, the tab button, labeled "History", is highlighted with an orange outline.

  2. 右键单击提交。

    • 如果提交只有一个标签,请单击**删除标签 TAG NAME**。
      Screenshot of a list of commits in the "History" tab. Next to a commit, in a context menu, the cursor hovers over an option labeled "Delete tag hello-tag".
    • 如果一个提交有多个标签,请将鼠标悬停在 **删除标签...** 上,然后点击要删除的标签。
      Screenshot of a context menu in the "History" tab. Next to "Delete tag", a second menu is expanded, and the cursor hovers over an option labeled "hello-tag".

进一步阅读