How to use tagging in Git
In this tutorial, you have learned how to use Git with Windows, Mac, or Command Line and worked with branching. Now we’ll explore tagging.
In Git, tagging allows you to mark important milestones, releases, or significant versions of your codebase. Tags serve as permanent references to specific points in your commit history. In this step-by-step tutorial, we will explore the concept of tagging and show you how to effectively use tags in Git. You will learn how to create lightweight tags and annotated tags, as well as delete them. By following along with our examples and exercises, you will gain practical experience in tagging your code and leveraging tags to mark releases and important commits. Get ready to enhance the organization and clarity of your Git workflow.
To learn more about tagging, you can revisit our introduction to tagging.
To follow along with this part of the tutorial, you’ll need to create a new directory named tutorial
and initialize a Git repository with the git init command, if you haven't already.
$ mkdir tutorial
$ cd tutorial
$ git init
Initialized empty Git repository in /Users/username/Desktop/tutorial/.git/
Next, create a new file named myfile.txt
in the tutorial
directory with the below content, and commit it.
Anyone can learn Git with this tutorial and Backlog
$ git add myfile.txt
$ git commit -m "first commit"
[main (root-commit) a73ae49] first commit
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 myfile.txt
At this point, the history looks like this: