Working with Git tags

Azure Repos | Azure DevOps Server 2019 | TFS 2018 | TFS 2017 | VS 2017 | VS 2015

Azure DevOps Services and TFS support both annotated and lightweight tags. Lightweight tags are a pointer to specific commit, while annotated tags contain more information such as the tagger, message, and date. You can create annotated tags using the web portal, and starting with Visual Studio 2017 Update 6, you can create both lightweight and annotated tags from within Visual Studio. For more information on Git tags, see 2.6 Git Basics - Tagging from the Pro Git book.

This article provides an overview of working with Git tags in Azure DevOps Services, TFS, and Visual Studio.

Important

The Tags view in Visual Studio was introduced in Visual Studio 2017 Update 6. If you are on versions earlier than this, you can view and create tags from the history and commit details views starting with Visual Studio 2015, but you won't be able to perform the operations in the Tags view as described in this article.

View and filter tags

You can view tags in the Tags view and in the Commits view in the web portal.

Note

Project URLs have changed with the release of Azure DevOps Services and now have the format dev.azure.com/{your organization}/{your project}, but you can still use the existing visualstudio.com format. For more information, see VSTS is now Azure DevOps Services.

View tags in the Tags view

  1. To view the tags in your repo, navigate to your project in the web portal, choose Repos, Tags, and select the desired repo.

    View tags

    Annotated tags are displayed with a tag name, message, commit, tagger, and creation date. Lightweight tags are displayed with a tag name and commit.

  2. To filter the list of tags, type a search term into the Search tag name box and press Enter.

    Filter tags

View tags in the Commits view

  1. To view tags for a specific branch in the Commits view, navigate to your repo in the web portal, choose Repos, Commits, and select your branch.

    View tags

You can view tags in the Tags view and in the Commits view in the web portal.

Note

Project URLs have changed with the release of Azure DevOps Services and now have the format dev.azure.com/{your organization}/{your project}, but you can still use the existing visualstudio.com format. For more information, see VSTS is now Azure DevOps Services.

View tags in the Tags view

  1. To view the tags in your repo, navigate to your project in the web portal, choose Code, select the desired repo, and choose Tags.

    View tags

    Annotated tags are displayed with a tag name, message, commit, tagger, and creation date. Lightweight tags are displayed with a tag name and commit.

  2. To filter the list of tags, type a search term into the Search tag name box and press Enter.

    Filter tags

View tags in the Commits view

  1. To view tags for a specific branch in the Commits view, navigate to your repo in the web portal, choose Code, Commits, and select your branch.

    View tags

Visual Studio

You can view tags in the Tags view and in the History view.

View tags in the Tags view

  1. To view all tags in a repo, select Tags from the Home view.

    Tags button

  2. Tags are displayed under the currently connected repo name.

    View tags

    Annotated tags display a tooltip that contains the tag name, tagger, tag date, and message. Lightweight tags have only the tag name in the tooltip.

    View tags

    For more information about the tagged commit, right-click the tag and select View Commit Details.

    Commit details

  3. To filter the list of tags, type a search term into the Type here to filter the list box.

    Filter tags

To retrieve the current list of tags from the source repo, perform a fetch operation.

View tags in the History view

You can also view tags in the History view, for example by navigating to the Branches view, right-clicking the desired branch, and choosing View History. The red shapes are branches, and the green shapes are tags.

View tags

Create tag

To create a tag, you must have the Create Tag permission, which is included by default in the Contributors group and higher.

You can create annotated tags using the web portal from both the Tags view and the Commits view.

Important

You can only create annotated tags in the web portal. To create a lightweight tag, you can use Git command line or Visual Studio.

Create tags from the Tags view

  1. Select Create Tag from the Tags view in the web portal to create a new annotated tag.

    Create tag

  2. Specify a Name, select the branch to Tag from, enter a Description (required since you are creating an annotated tag), and select Create.

    Create tag

  3. The new tag is displayed in the tag list.

    View new tag

Create tags from the Commits view

  1. To create a tag directly from the commits view, right-click the desired tag and choose Create tag.

    Create tag

You can create annotated tags using the web portal from both the Tags view and the Commits view.

Important

You can only create annotated tags in the web portal. To create a lightweight tag, you can use Git command line or Visual Studio.

Create tags from the Tags view

  1. Select Create Tag from the Tags view in the web portal to create a new annotated tag.

    Create tag

  2. Specify a Name, select the branch to Tag from, enter a Description (required since you are creating an annotated tag), and select Create.

    Create tag

  3. The new tag is displayed in the tag list.

    View new tag

Create tags from the Commits view

  1. To create a tag directly from the commits view, right-click the desired tag and choose Create tag.

    Create tag

Visual Studio

You can create both annotated and lightweight tags in Visual Studio from both the Tags view and the History view. To create an annotated tag, provide both a name and a message when creating the tag. To create a lightweight tag, omit the message and supply only a name.

Create tags from the Tags view

  1. Select New Tag in the Tags view to create a new tag.

    Create tag

  2. To create a tag against the tip of the current branch, specify a name in the Enter a tag name box, optionally provide a tag message, and select Create Tag.

    Create tag

    To select the branch to create the tag from, clear the Create tag against tip of current branch check box, and select a branch from the Select a branch drop-down.

    Create tag

  3. The new tag is created locally. Right-click the new tag and choose Push to push it to the remote repo. Select Push All to push all new local tags to the remote repo.

    Push new tag

Create tags from the History view

  1. To create a tag directly from the history view, right-click the desired commit and choose Create Tag.

    Create tag

Delete tag

Important

Use caution when deleting tags from your repo. If the repo has been pulled, forked, or cloned by another user, the tag will still exist in their copy of the repo. You should only delete local tags, or if you are sure that the repo hasn't been pulled, cloned, or forked since you created your tag.

To delete a tag, you must have the Force Push permission at the Repository level or the All tags level (which inherits its permissions from the repository level if not explicitly set).

Delete a tag in the remote repo

The steps in this procedure show you how to delete a tag in the remote repo using the Azure DevOps Services web portal.

  1. To delete a tag, select the ellipsis to the right of the tag name and choose Delete tag.

    Delete tag

  2. Select Delete to confirm.

    Delete tag

  3. The tag is deleted, and won't be displayed the next time you navigate to the Tags view.

    Tag deleted

Delete a tag in the remote repo

The steps in this procedure show you how to delete a tag in the remote repo using the Azure DevOps Services web portal.

  1. To delete a tag, select the ellipsis to the right of the tag name and choose Delete tag.

    Delete tag

  2. Select Delete to confirm.

    Delete tag

  3. The tag is deleted, and won't be displayed the next time you navigate to the Tags view.

    Tag deleted

Visual Studio

The steps in this procedure show you how to delete a tag in the local repo using Visual Studio 2017 Update 6.

  1. Right-click the tag to delete and choose Delete Locally

    Delete tag

Important

If your tag has already been pushed to the remote repo, you should not delete it. If the repo has been pulled, forked, or cloned by another user, the tag will still exist in their copy of the repo. You should only delete local tags.

Create branch from a tag

  1. To create a branch from a tag, select the ellipsis to the right of the tag name and choose New branch.

    New branch from tag

  2. Specify a Name, optionally select any Work items to link, and choose Create branch.

    New branch from tag

  3. The branch is created and you are taken to the new branch in the web portal.

    New branch from tag

  1. To create a branch from a tag, select the ellipsis to the right of the tag name and choose New branch.

    New branch from tag

  2. Specify a Name, optionally select any Work items to link, and choose Create branch.

    New branch from tag

  3. The branch is created and you are taken to the new branch in the web portal.

    New branch from tag

Visual Studio

  1. To create a branch from a tag, right-click the tag and choose New Local Branch From. You can also choose Create Branch From Tag.

    New branch from tag

  2. Specify a branch name, verify the desired tag, and choose Create Branch. To checkout the new branch after it is created, choose Checkout branch.

    New branch from tag

  3. To view your newly created branch, select Branches from the Home view.

    New branch from tag

  4. Note that your new branch is created locally. To push the branch, right-click it and choose Push Branch.

    Push new branch from tag

View tag history

  1. To view the history for a tag, select the ellipsis to the right of the tag name and choose View history.

    View tag history

  2. You are taken to the commits view for the tag.

    Tag history

  1. To view the history for a tag, select the ellipsis to the right of the tag name and choose View history.

    View tag history

  2. You are taken to the commits view for the tag.

    Tag history

Visual Studio

  1. To view the history for a tag, right-click the tag and choose View History.

    View tag history

  2. The history is displayed in the History view.

    Tag history