Tags and their use
Tags are a way to mark a specific point in the history of a repository. They are often used to mark a release or a specific commit that is important.
Tags are immutable, meaning that once they are created, they cannot be changed. We need to delete the tag and create a new one if we want to change the tag.
We create a tag using the git tag <identifier>
command. We can list tags using git tag
. We can also create an annotated tag using the -a
option.
We can list tags using git tag
. We can also create an annotated tag using the -a
option.
Exercise: Create a tag
- Create a tag named
v1.0
for the latest commit.- List all tags.
Solution: Create a tag
git tag v1.0
List the tags:
git tag
Output:
v1.0