top of page
  • Writer's pictureGanesh Palnitkar

02 - Working with Git Tags

Updated: Aug 19, 2023

GIT has a functionality that allows user to tag (assign a flag) a specific version in the repository which may be important and should be easily traceable from version history.

TAGs in GIT SCM are created to mark an important version (hash-code) for easy future references or retrievals.

Annotated tags are meant for Prod. Release (major events) while lightweight (less important events) tags are meant for private or temporary object labels. This affects the commands like git describe in some way.

Some git commands for naming objects (like git describe) will ignore lightweight tags by default.

To start with tagging a version (hash code) in git, with annotation and comments, typically for major events like Production release / UAT etc. we use below command.

$ git tag –a <tag_name> <hash_code> -f –m “< detailed comment>”

If a hash code (SHA-1) is not mentioned in the above command, then the TAG is created with reference to latest version (SHA-1 code).

Here are the results while using the tag creation commands.








We can also use git show command to get details about the TAG, like,

$ git show <tagname>

or we can also use git cat-file command as,

$ git cat-file –p <tagname>

Deleting a TAG can be done using,

$ git tag –d <tagname>

8 views0 comments

Comments


bottom of page