Add a tag
Adding a tag in Git is a valuable practice that allows you to mark significant milestones, releases, or important versions of your codebase. Tags serve as permanent references to specific points in your commit history, making it easier to navigate and communicate about important versions of your project.
In this part of our tutorial, we will delve into the process of adding a tag in Git. By incorporating tags into your workflow, you'll be able to track important milestones, communicate with ease, and facilitate smoother collaboration within your team.
Use the git tag command to add a new tag named tag1
.
$ git tag tag1
Then, run the tag command without any parameters, and you’ll see a list of tags in this repository, including the one we just added.
$ git tag
tag1
To see the history log with tag information, execute the git log command with the --decorate
option.
$ git log --decorate
commit e7978c94d2104e3e0e6e4a5b4a8467b1d2a2ba19 (HEAD, tag: tag1, main)
Author: yourname <yourname@yourmail.com>
Date: Wed Jul 18 16:43:27 2022 +0900
first commit
This is how our history looks now.