Git concepts: tag
A Git tag is a specific point in the Git history that is used to capture a point in time of the repository's state. It's essentially a reference to a specific commit. Tags are often used to mark release points, like v1.0, v1.1, and so on.
There are two types of tags in Git: lightweight and annotated.
A lightweight tag is just a pointer to a specific commit. It's a simple reference to a commit hash.
Annotated tags are more complex. They are stored as full objects in the Git database, containing additional metadata like tagger name, email, date, and tag message. They can also be signed and verified with GNU Privacy Guard (GPG).
Tags are not associated with branches - they are associated with a specific commit. That means even if branches move on, the tag will still point to the same commit unless explicitly updated.
So, how are tags related to commits and branches?
Relationship with commits: A tag signifies a specific commit. It's like a label that makes it easier to recall a commit. Instead of using the complex commit hash, you can simply use the tag name.
Relationship with branches: While tags are not directly related to branches, they work in a similar way. Both are pointers, but while a branch pointer automatically moves forward with each new commit, a tag stays at the same commit unless manually moved.
To summarize, Git tags are references to specific points in your Git history typically used to mark particular events like releases or significant developments. They relate to commits as a label for easy recall and, like branches, they are pointers but with a static nature.