Menu
Coddy logo textTech

Git Tag

Last updated

git tag marks a specific commit with a name - usually a release version like v1.0.0. Tags come in two forms: lightweight (just a name pointing at a commit) and annotated (a full object with a message, author, and date). Tags aren't pushed automatically, so you push them separately.

Try these in the terminal playground - a real shell in your browser, nothing to install.

git tag pins a permanent name like v1.0 to one commit - the tag stays put as the branch moves on.

Syntax

CommandWhat it does
git tag v1.0.0Create a lightweight tag on HEAD
git tag -a v1.0.0 -m "Release 1.0"Create an annotated tag with a message
git tag -a v1.0.0 <hash>Tag a specific past commit
git tagList all tags
git push origin v1.0.0Push one tag to the remote
git push --tagsPush all tags
git tag -d v1.0.0Delete a local tag

lightweight vs annotated

LightweightAnnotated
Stores a messageNoYes
Records author & dateNoYes
Good for releasesNoYes

Git tag FAQ

How do I create a tag in Git?
For a quick marker, run git tag <name> (a lightweight tag on the current commit). For a release, create an annotated tag: git tag -a v1.0.0 -m "Release 1.0", which stores a message, author, and date. Add a commit hash at the end to tag an older commit.
What's the difference between lightweight and annotated tags?
A lightweight tag is just a name pointing at a commit - no extra data. An annotated tag is a full Git object with a message, tagger name, and date, and it can be verified. Use annotated tags for releases; lightweight tags are fine for temporary or private markers.
How do I push tags to the remote?
Tags aren't included in a normal git push. Push a specific tag with git push origin <tagname>, or push every tag at once with git push --tags. This trips people up - a tag you created stays local until you push it.
How do I delete a tag?
Delete a local tag with git tag -d <tagname>. To also remove it from the remote, run git push origin --delete <tagname> (or the older git push origin :refs/tags/<tagname>). Local and remote tag deletions are separate steps.
Can I practice this online?
Yes. Open the terminal playground to run git tag in a real shell in your browser - nothing to install. Coddy's free interactive Git course also covers tagging and releases step by step.
Coddy programming languages illustration

Learn Git with Coddy

GET STARTED