---
title: "How do I create and push a Git tag for a release?"
description: "Create an annotated tag for a release, push it to the remote, and fix or delete a tag you got wrong, with the difference between lightweight and annotated tags."
url: https://www.danny.engineering/answer/git/how-do-i-create-and-push-a-git-tag-for-a-release
author: Danny
published: 2026-11-27T00:00:00.000Z
updated: 2026-11-27T18:57:00.000Z
tags: ["Git"]
---

# How do I create and push a Git tag for a release?

## The short answer


Create an annotated tag with `git tag -a`, then push it by name. Tags are not sent by a plain `git push`, so you have to push them explicitly.


```bash
git tag -a v1.4.0 -m "Release 1.4.0"
git push origin v1.4.0
```


## Why it happens


A tag is a name that points at one commit and, unlike a branch, does not move when you make new commits. That makes it the natural way to mark a release.


Git has two kinds:

- Lightweight tags, made with `git tag v1.4.0`, are just a name for a commit, like a branch that never moves.
- Annotated tags, made with `-a`, are full objects in the repository with their own message, tagger name, date and optional signature.

For releases, use annotated tags. They record who made the release and when, `git describe` uses them by default, and `git push --follow-tags` only pushes annotated tags.


Tags are kept out of `git push` by default so that local bookmarks do not end up on the shared remote by accident.


## How to fix it


### Tag the current commit


Make sure you are on the commit you are releasing, usually the tip of `main`, then tag it:


```bash
git switch main
git pull
git tag -a v1.4.0 -m "Release 1.4.0"
git show v1.4.0            # check the tag message and the commit it points at
```


Leave off `-m` to write a longer message, such as release notes, in your editor.


### Tag an earlier commit


Pass the commit hash after the tag name:


```bash
git log --oneline -10
git tag -a v1.3.1 8d2f6b0 -m "Release 1.3.1"
```


### Push tags to the remote


Push a single tag by name:


```bash
git push origin v1.4.0
```


Or push your commits and any annotated tags that point at them in one step:


```bash
git push --follow-tags
```


To make that the default for every push:


```bash
git config --global push.followTags true
```


`git push --tags` also works but sends every local tag, including old experiments, so it is better to push by name.


### List and inspect tags


```bash
git tag                    # all tags
git tag -l "v1.*"          # tags matching a pattern
git describe --tags        # nearest tag to the current commit
```


### Fix or delete a tag


If you tagged the wrong commit and have not pushed yet, delete it locally and create it again:


```bash
git tag -d v1.4.0
git tag -a v1.4.0 -m "Release 1.4.0"
```


If it is already on the remote, delete it there too:


```bash
git push origin --delete v1.4.0
```


Once other people or a deploy pipeline have used a tag, it is usually better to release a new version, such as `v1.4.1`, than to move the old one. Clones that already fetched the tag keep the old commit and will not update it automatically.


### Sign release tags


If your team verifies releases, create a signed tag with `-s` instead of `-a`. It needs a GPG or SSH signing key configured in Git.


```bash
git tag -s v1.4.0 -m "Release 1.4.0"
git tag -v v1.4.0          # verify the signature
```


## Common pitfalls

- Expecting `git push` to send tags. It does not, unless you use `--follow-tags`, `--tags` or push the tag by name.
- Using lightweight tags for releases, then wondering why `--follow-tags` skipped them.
- Giving a tag the same name as a branch. Commands then become ambiguous; a `v` prefix such as `v1.4.0` avoids clashes.
- Moving a published tag. Other clones keep the old one, so people end up building different code for the same version.
- Tagging before pulling, so the tag points at an out of date commit.

## Related reading

- [Git documentation: git tag](https://git-scm.com/docs/git-tag)
- [Pro Git: Tagging](https://git-scm.com/book/en/v2/Git-Basics-Tagging)
