Annotate a tag
Annotating a tag in Git goes beyond simple marking and provides you with the opportunity to add context and valuable information to your important milestones, releases, or versions. Annotated tags serve as permanent references to specific points in your commit history, supplemented with additional details such as author information, release notes, or relevant commit messages.
In this part of our tutorial, we will explore the process of annotating a tag in Git. By incorporating annotated tags into your Git workflow, you'll be able to communicate important information, provide valuable insights to future collaborators, and better document the evolution of your codebase.
We can add an annotation to a tag by running the git tag command with the -a
option, which opens the default text editor that lets you add notes.
You can also use the -am
option instead if you want to add the note alongside the tag creation.
Run the following command to add a tag for HEAD named tag2
with some notes:
$ git tag -am "Simple Git tutorial for beginners" tag2
Using the -n
option will give you the list of tags with their notes for this repository.
$ git tag -n
tag1 first commit
tag2 Simple Git tutorial for beginners