Tags work as an additional identifier for a particular incident. And in the case of Git.
Tags are used as the reference points in your development workflow and it denotes special events like a new version release or new commit. You can create a new tag to give a reference for your newly launched version. Tagging helps you in identifying the particular commit or release of your code in past.
As a developer, you are probably interacting with Git tags on a daily basis.
Git tags used as reference points in your development worflow.
You might want to create new Git tags in order to have a reference to a given release of your software.
In this tutorial, we are going to see how you can easily create Git tags.
There are two types of Git tags:
- Annotated tags (tags with a description)
- Lightweight tags (tags don’t include any description)
Create Git Tags
- To create a git tag, we use the git tag command as shown below
git tag [tag-name]
- Creating a new tag for your latest launch for example, run the command below.
git tag v2.0
- To verify that your Git tag was successfully created, you can run the “git tag” command to list your existing tags.
git tag v1.0 v2.0
- If you want to create a tag with a message, you can execute the following command.
git tag -a [tag-name] -m “Your message”
git tag -a v2.0 -m "Hello Unixcop"
- Verify your tag with running this command below.
git tag -n
- push tags you have with executing the command below.
git push --tags
In this tutorial, you learnt how you can easily create Git tags for your projects, create them with a message and push them.
You may also want to clone a Git repo into a folder so kindly visit this article How to Clone a Git Repository Into a Specific Folder.
Thank you !!