Tags in Git are references to specific commits, commonly used to specify release points (e.g., v1.0, v2.0) in the development process. If you're collaborating on a project or managing multiple versions, you may want to check the available tags in a remote repository. This tutorial explains how to get all remote tags in Git.
Git supports two types of tags: annotated and lightweight. Lightweight tags are simple pointers to a commit, serving as bookmarks for specific commits. In contrast, annotated tags are stored as full objects in the Git database and include metadata such as the tagger's name, email, date, and a tagging message.
To fetch a list of all remote tags from a repository, use the following command:
git ls-remote --tags
The output will display a list of commit hashes and corresponding tag references. Sample output:
From https://github.com/opencv/opencv.git
bb9bf53eb1b6a6940f416729718607d1d4b02b07 refs/tags/2.2
b1459928f576c36e8857bac987c49a0c84d77656 refs/tags/2.3.0
2154e6251f15dd1bd6b334c6b29657ba183067f2 refs/tags/2.3.1
...
d7d867066ae146114613661bd3a20a53cda9c16c refs/tags/4.9.0
dad8af6b17f8e60d7b95a1203a1b4d22f56574cf refs/tags/4.9.0^{}
A tag ending in ^{}
represents an annotated tag.
Leave a Comment
Cancel reply