Git: List Tags – How to Show Tags in Git

Tags in a Git repository can be listed using the git tag command.

Before listing all the tags it is required to ensure that the latest tag list from the remote repository has been fetched.

On the other hand, even without pulling or fetching, it is possible to get a list of tags on the remote Git repository.

In this note i will show how to list all the tags in a Git repository.

List Tags in Git

Make sure that you have the latest tag list from the remote repository locally:

$ git fetch --all --tags --prune

List all the tags in a Git repository:

$ git tag

Show tags along with the first line of annotation message or the first commit message line if the tag is not annotated:

git tag -n

Show tags with the first 5 lines of the annotation or commit message:

git tag -n5

List all tags with a given pattern e.g. list all tags starting with v:

$ git tag -l "v*"

Even without pulling or fetching, you can get the list of tags on the upstream Git repository using the following command:

$ git ls-remote --tags