git show-ref --tags

Show each tag name and its commit hash in the local repository.

This command quickly displays every tag reference in your local repo alongside its corresponding object ID, making it easy to confirm where tags point. It uses git show-ref to read all refs from .git/refs and packed-refs, then filters them with --tags so only entries under refs/tags/ appear. Each output line lists the commit hash followed by the fully qualified tag name.

The output is sorted by reference name and shows only tags; you can pipe it through tools like grep or cut to extract specific tags or hashes, and you can add -d to dereference annotated tags and show both the tag object ID and the tagged commit.

For related commands, use git show-ref without filters to list all refs, git show-ref --heads to list branches, or combine --heads --tags to list both. You can also use git tag -l to list tag names alone or git ls-remote --tags <remote> to view tags on a remote repository.

Related commands

Welcome to GitExamples!

Sign in to enable bookmarking, reminders, progress-tracking and more...