Like many other version management systems, Git also offers a tagging feature that allows selected points in the history of a repository to be marked as important. These tags are typically used to label the releases of a software program (like version 1.0, 2.0, etc.) so that they remain easy to access even for larger projects. Git supports two types of tags:
- “Annotated” tags are saved as independent objects in the database, including their own checksum, tagging message, date, name, and email address of the tag author as well as an optional GNU Privacy Guard signature (GPG signature).
- “Lightweight” tags act like branches, only serving as a reference to a commit. This type is suitable when you only need temporary tags or don’t want to save the extended information.
You can create annotated tags in Git by using the “git tag -a” command on the respective commit. If you also add the “-m” parameter as a suffix, you can compose the desired tagging message directly in the command line (between straight quotation marks). In this Git guide, we generated the “Test” commit which we can also link with a tag including the message “example tag”: