Advertisement

List Tags

Show all tags in repository.

git tag

List tags matching pattern:

git tag -l "v1.*"

Create Lightweight Tag

Create a simple tag pointing to current commit.

git tag <tag-name>

Example:

git tag v1.0.0

Create Annotated Tag

Create tag with message and metadata.

git tag -a <tag-name> -m "Tag message"

Example:

git tag -a v1.0.0 -m "Release version 1.0.0"

Tag Specific Commit

Create tag for a past commit.

git tag -a <tag-name> <commit-hash> -m "Message"

Show Tag Information

Display detailed information about a tag.

git show <tag-name>

Push Tags to Remote

Push specific tag to remote.

git push origin <tag-name>

Push all tags:

git push origin --tags

Push annotated tags only:

git push --follow-tags
Advertisement

Delete Local Tag

Remove a tag from local repository.

git tag -d <tag-name>

Delete Remote Tag

Remove a tag from remote repository.

git push origin --delete <tag-name>

Alternative syntax:

git push origin :refs/tags/<tag-name>

Checkout Tag

Switch to a specific tag (detached HEAD).

git checkout <tag-name>

Create branch from tag:

git checkout -b <branch-name> <tag-name>

Fetch Remote Tags

Download tags from remote repository.

git fetch --tags

Compare Tags

Show differences between two tags.

git diff <tag1> <tag2>

Show commits between tags:

git log <tag1>..<tag2>

Rename Tag

Rename an existing tag.

git tag <new-tag> <old-tag>
git tag -d <old-tag>
git push origin :refs/tags/<old-tag>
git push origin <new-tag>

Verify Signed Tag

Verify GPG signature of a tag.

git tag -v <tag-name>
Last updated: January 2026
Advertisement