Skip to content

How to Create and Push Git Tags

DodaTech 2 min read

In this tutorial, you'll learn about How to Create and Push Git Tags. We cover key concepts, practical examples, and best practices.

The Problem

You want to mark a specific commit as a release version with a Git tag, but git push does not include tags by default. After running git push, the tag is not visible on GitHub or GitLab.

Quick Fix

Step 1: Create a lightweight tag

Tag the current commit with a version number:

git tag v1.0.0

List all tags to confirm:

git tag
v1.0.0

Step 2: Create an annotated tag

Annotated tags store a message and metadata:

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

View the tag details:

git show v1.0.0
tag v1.0.0
Tagger: Your Name <you@example.com>
Date:   Mon Jun 24 10:00:00 2026 +0000

Release version 1.0.0 with user authentication

Step 3: Tag a specific commit

If the release is not at HEAD, tag a past commit by its hash:

git tag -a v0.9.0 abc123def -m "Beta release"

Step 4: Push a single tag

Push one tag to the remote:

git push origin v1.0.0
Enumerating objects: 1, done.
Counting objects: 100% (1/1), done.
Writing objects: 100% (1/1), 164 bytes, done.
Total 1 (delta 0), reused 0 (delta 0)
To https://github.com/username/my-project.git
 * [new tag]         v1.0.0 -> v1.0.0

Step 5: Push all tags

Push every local tag that is not yet on the remote:

git push --tags

Step 6: Delete a tag

Remove a tag locally and on the remote:

git tag -d v1.0.0
git push origin --delete v1.0.0

Alternative Solutions

Use signed tags for verification

Sign tags with your GPG key for authenticity:

git tag -s v1.0.0 -m "Release v1.0.0"

Create lightweight tags for temporary markers

Use lightweight tags for CI milestones:

git tag build-20260624.1

Common Mistakes to Avoid

Forgetting to push tags separately. git push does not include tags. Use git push --tags or git push origin <tag> explicitly.

Creating a tag on the wrong commit. Check the current commit with git log --oneline -1 before tagging. Use git tag <name> <hash> to tag a specific commit.

Not using annotated tags for releases. Lightweight tags lack metadata like the tagger name, date, and message. Use git tag -a for releases.

Pro Tips

Use semantic versioning for tags. Follow vMAJOR.MINOR.PATCH format (e.g., v2.1.0) for consistency across projects.

Use git tag -s for signed tags. Sign tags with your GPG key to verify authenticity: git tag -s v1.0.0 -m "Release v1.0.0".

Automate tagging with CI. Configure your CI pipeline to create and push tags automatically after successful builds on the main branch.

Prevention

  • Always use annotated tags (-a -m) for releases to include metadata.
  • Push tags immediately after creating them so they are not lost.
  • Use semantic versioning (v1.0.0, v1.1.0, v2.0.0) for consistency.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro