Skip to main content
Chapter 59 of 61 · 2 sections · Page 184

Git: Git Tagging

Create lightweight and annotated tags, list, search version tags, and push tags to remotes.

Original chapter reference: Chapter 59: Git Tagging. The command options and documentation recipes below are fully transcribed from Git Notes for Professionals.

Like most Version Control Systems (VCSs), Git has the ability to tag specific points in history as being important. Typically people use this functionality to mark release points (v1.0, and so on).

Section 59.1: Listing all available tags

Using the command git tag lists out all available tags:

Source example · PDF page 184
$ git tag
<output follows>
v0.1
v1.3

Note: the tags are output in an alphabetical order.

One may also search for available tags:

Source example · PDF page 184
$ git tag -l "v1.8.5*"
<output follows>
v1.8.5
v1.8.5-rc0
v1.8.5-rc1
v1.8.5-rc2
v1.8.5-rc3
v1.8.5.1
v1.8.5.2
v1.8.5.3
v1.8.5.4
v1.8.5.5

Section 59.2: Create and push tag(s) in GIT

Create a tag:

To create a tag on your current branch:

Source example · PDF page 184
      git tag < tagname >

This will create a local tag with the current state of the branch you are on.

To create a tag with some commit:

Source example · PDF page 184
      git tag tag-name commit-identifier

This will create a local tag with the commit-identifier of the branch you are on.

Push a commit in GIT:

Push an individual tag:

Source example · PDF page 185
      git push origin tag-name

Push all the tags at once

Source example · PDF page 185
      git push origin --tags
Buy me a coffee
Daily Practice
0/0