How to use Git tags

In order to mark the current state of a Git repo for important points in history, like releases, you can use Git tags. Let’s see how:

How create Git Tags

Save current as v1.2

git tag -a v1.2 -m "Add X feature and minor fixes"

Push tags

To push all tags pending to upload remotely

git push origin --tags

In order to push just an specific tag:

git push origin v1.2

List tags

To list all tags

git tag

To list an specific branch of tags

git tag -l "v1.*"

In this example, will list all tags belonging to v1.

Fetch tag info

For a specific tag

git show v1.2

You’ll see the author, the datetime, commit message and a bit more data.

Read more on Git doc

David Burgos

Read more posts by this author.