View tags for git repositories
Git repositories now show tags that allow you to mark important points in your repo’s history. Now you can easily bookmark a specific commit in your git repository to compare to other commits in the future. In this post, I will talk about how you can easily manage following git tag related tasks in VSTS :
- create tag
- view tag
- delete tag
- manage tag security
Create a tag
If you know the commit that needs to be tagged then you can simply browse to the commit, click on the context menu, and click on Create tag.
You can also create a tag from the commit list view by clicking on Create tag from the context menu.
You can also create a tag from the Tags page by clicking on the Create tag button on the top left of the page.
The Create a tag dialog allows you to tag a commit. In VSTS you can only create annotated tags from this dialog. If you need to push lightweight tags to your remote repository, then you can create a lightweight tag and push it from the command line to show up in VSTS.
If you are not sure which commit to tag but are certain that you need to tag the latest commit in a branch, then click on Tag from dropdown and select the All branches tab. Next, you can simply filter to the branch name that you want to tag. This will tag the latest commit on the selected branch.
Once a commit is tagged, the tag shows up on the commit details page and commit list view. You can click on a tag to see the tag details i.e. the tag name, tag message, tagger and tagged date.
You can view all the tags on your repository on the Tags page. If you manage all your tags as releases, then the tags page gives a bird’s eye view of all the releases.
You can easily differentiate between a lightweight and an annotated tag here as annotated tags show the tagger and the creation date alongside the associated commit while lightweight tags only show the commit information.
There are several other operations that you can perform on tags from VSTS such as :
- comparing commits and changes between any two tags
- create a new branch from the tag
Occasionally, there can be times when you want to delete a tag from your remote repo. It could be due to a typo in the tag name or you you might have tagged the wrong commit. You can easily delete tags from the VSTS UI by clicking on the context menu of a tag on the Tags page and clicking on Delete tag.
Note: Deleting tags on remote repos should be exercised with caution.
For old repositories, the number of tags can grow significantly with time or there are repositories that have tags created in hierarchies which can make finding tags difficult. If you are unable to find the tag that you were looking for on the tag page, then you can simply Search tag name using the filter on the Tags page.
Now you can grant granular permissions to users on the repo to manage tags.
|Create tag||Browse to Settings -> Version Control and click on the repository where you want to grant permission.|
Select a user and set the Create tag permission to allow or deny.
|Delete tags & Manage permissions||You can manage granularly at the repo level as to who can delete tags.|
How can we make git tags experience better for you? Here is how you can get in touch with us