How do you create an annotated tag in Git?

How do you create an annotated tag in Git?

a) git tag -a tagname
b) git create tagname
c) git annotate tagname
d) git label tagname

Answer:

a) git tag -a tagname

Explanation:

The git tag -a tagname command creates an annotated tag in Git. Annotated tags include additional metadata such as the author’s name, date, and a message, making them more informative than lightweight tags.

For example, running git tag -a v1.0 -m "Version 1.0 release" creates an annotated tag for version 1.0 with a message describing the tag.

Annotated tags are useful for marking releases and milestones, providing more context and history than lightweight tags.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top