mdawar.dev

A blog about programming, Web development, Open Source, Linux and DevOps.

Git Tag

Create Tag

Annotated tag (Recommended):

bash
$# Annotated tag contains more information:
$# checksum, tagger name, email, date, tag message
$git tag -a v1.2.0 -m "Version 1.2.0"

Lightweight tag:

bash
$# Lightweight tag is just a pointer to a specific commit
$git tag v1.2.0

Tag Old Commit

Specify the commit checksum (or part of it) to tag an old commit:

bash
$git tag -a v1.2.0 24bba8b

List Tags

bash
$# List all tags in alphabetical order
$git tag
$# Search for tags that match a pattern
$git tag -l "v1.0.0*"

Display Tag Info

bash
$git show v1.2.0

Delete Tag

bash
$# Delete from the local repository
$git tag -d v1.2.0
$# Delete from the remote server
$git push origin --delete v1.2.0

Create Branch From Tag

bash
$git checkout -b branch-name v1.2.0