Skip to main content

Git Tag

Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/git-tag

In short

A Git tag is a named, permanent pointer to a specific commit, most often used to mark release versions such as v1.0.0 in a repository's history.

What is a Git tag?

A Git tag is a human-readable label attached to one specific commit. Unlike a branch, which moves forward every time you commit, a tag stays on the same commit unless someone deliberately deletes or moves it. Teams mainly use tags to mark releases, so anyone can find exactly which code shipped as version v2.3.0.

Git has two kinds of tags. A lightweight tag is just a name pointing at a commit, like a bookmark. An annotated tag, created with git tag -a, is stored as a full Git object that includes the tagger's name, a date, a message, and optionally a cryptographic signature, which is why annotated tags are recommended for releases. Tags are not pushed by default, so you must send them explicitly with git push origin v2.3.0 or git push --tags.

Think of a tag like a sticky note in a book's revision history that says 'this is the edition we printed'. Tags usually follow semantic versioning, such as v1.4.2, and CI/CD pipelines often watch for new tags to build and publish a release automatically. Code hosting platforms also use tags as the basis for release pages and downloadable source archives.

The most common confusion is tag versus branch. A branch is a movable pointer meant for ongoing work, while a tag is a fixed pointer meant to record a moment in history. If you check out a tag directly, Git puts you in a detached HEAD state, which means new commits won't belong to any branch unless you create one.

Key takeaways

  • A tag is a fixed, named pointer to a single commit.
  • Annotated tags store an author, date, and message and are recommended for releases.
  • Lightweight tags are simple name-to-commit pointers with no extra data.
  • Tags must be pushed explicitly; a plain git push does not send them.
  • Unlike branches, tags do not move when new commits are added.

Example

Creating, pushing, and deleting Git tagsbash
# Create an annotated tag for a release on the current commit
git tag -a v1.2.0 -m "Release 1.2.0"

# List tags and show the details of one
git tag
git show v1.2.0

# Tags are not pushed automatically
git push origin v1.2.0

# Delete a tag locally and on the remote
git tag -d v1.2.0
git push origin --delete v1.2.0

Readers ask

What is the difference between a Git tag and a branch?

A branch is a pointer that moves forward as you add commits, while a tag stays attached to one commit permanently. Branches are for ongoing work; tags mark fixed points such as releases.

Should I use annotated or lightweight tags?

Use annotated tags for releases and anything you share, because they record who created the tag, when, and why, and they can be signed. Lightweight tags are fine for temporary, private bookmarks.

How do I push tags to a remote?

Push a single tag with git push origin <tagname>, or push all local tags with git push --tags. You can also use git push --follow-tags to push commits together with the annotated tags that point to them.

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings