Using tags in Git

Today we’ll give you an understanding of the tags and show you a list of git commands to play with tags.

Tagging in Git

  1. Create a light-weighted tag
  2. Get tag list
  3. Search tags using patterns
  4. Create a annotated tag
  5. Push tag to the remote repository
  6. Checkout tag
  7. Delete tag locally
  8. Delete tag remotely
  9. Create a new branch from tag

1. Create a light-weighted tag

To create a tag, run the following command. It’s also known as a light-weighted tag.

Make sure you will checkout the branch where you want to create a tag.

The above tag command will create a mark point on the branch as <tag_name>.

2. Get tag list

We can list the available tags in our repository using following command.

Use the following command to check the details of a particular tag.

3. Search tags using patterns

You can also search the list of tags using patterns.

4. Create a annotated tag

Annotated tags are tags that store extra metadata like developer name, email, date, and more.

5. Push tag to the remote repository

Use the following command to push the particular tag to the remote repository.

Use the --tags to push all the tags to the remote repository.

6. Checkout tag

Run the following command to checkout the perticular tag.

7. Delete tag locally

Use the following command to delete a tag locally.

8. Delete tag remotely

After deleting the tag from local, you can still see the tag on remote repository. So run the following command to delete a tag from a remote repository.

9. Create a new branch from tag

If you want to create a new branch from a specific tag then use the following command.

I hope you find this article helpful.
Thank you for reading. Happy Coding..!! 🙂

If you found value in this article,
you can support us by buying me a coffee! ☕

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *