Create and push a release tag

Low risk
What do risk levels mean?
Read-only
Inspects state without changing anything.
Low risk
Reversible with a routine follow-up command.
Medium risk
Changes state; undo path documented.
Destructive
Deletes or overwrites; confirmation required.

Creates an annotated tag marking the current commit as a release and pushes it to the remote so CI and collaborators can see it.

gittagrelease

Parameters

Tag name, e.g. v1.2.0.

Annotation message stored with the tag.

Commands

Confirm the commit that will be tagged

git log --oneline -1

Create an annotated tag on the current commit

git tag -a <tag> -m "Release"

Publish the tag to the remote

git push origin <tag>

Verification

git ls-remote --tags origin <tag>

The tag appears on the remote pointing at the expected commit.

Undo

Remove the tag from the remote

git push origin --delete <tag>

Remove the local tag

git tag -d <tag>

Pitfalls

  • Deleting a pushed tag does not undo anything a release pipeline already did with it.
  • Tags do not move; tagging the wrong commit means deleting and recreating the tag.

Related