Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

git

What is the git tag -a tagname -m command in Git?

Amaaz Ahmad

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

In Git, a tag refers to a specific point in the entire history of the Git project. Git can mark a specific point or state of the project.

There are two types of tags in Git:

  • Annotated tags: These types of tags store a brief message and meta-data like the date, email/name of the tagger, etc.
  • Lightweight tags: These types of tags store only the name of the tag and the commit checksum. It can be created by not passing any of the -a, -s, or -m options.

We use the git tag command along with different options to create both kinds of tags.

Annotated tags

Annotated tags store detailed information like the name of the tagger, email, and date.

To create an annotated tag, we use the -a option with the git tag command, as shown in the snippet below:

git tag -a tag_name

In the above snippet of code, tag_name must be replaced by a unique name for the tag.

We can also include a brief message or description while creating an annotated tag. This message is shown when the tag’s information is displayed. To add a message with the tag, we use the -m option, as shown in the snippet below:

git tag -a tag_name -m tag_message

In the above snippet of code, tag_name will be replaced by the name of the tag, and tag_message is replaced by the brief message or description to be stored along with the tag’s information.

RELATED TAGS

git

CONTRIBUTOR

Amaaz Ahmad
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring