Open In App
Related Articles

Using Tags in Git

Improve Article
Save Article
Like Article

Tagging in GIT refers to creating specific points in the history of your repository/data. It is usually done to mark the release points.

Two main purposes of tags are:

  • Make Release point on your code.
  • Create historic restore points.

You can create tags when you want to create a release point for a stable version of your code. You can also create tags when you want to create a historic point for your code that you can refer to in the future to restore your data.

To create a tag we need to go through the following steps:

Step 1: Checkout to the branch you want to create the tag.

 git checkout {branch name} 

Step 2: Create a tag with some name

 git tag {tag name} 

There are many more ways in which we create tags.
Annotated Tags

 git tag -a {tag name} -m {some message} 

Step 3: See all the created tags.

 git tag

To see the details of the tag we can use

 git show {tag name} 

To see tags starting with some letters

 git tag -l "v2.*"

Step 4: Push tags to remote.

git push origin {tag name}
git push --tags

“git push –tags” will push all tags at once.



Step 5: Delete Tags. (locally)

git tag -d {tag name}
git tag --delete {tag name}

Step 6: Delete tags from remote

git push origin -d {tag name}
git push origin --delete {tag name}
git push origin :{tag name}

“git push origin -d {tag name}” can also delete tag locally and remote at the same time.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 08 Jun, 2020
Like Article
Save Article
Similar Reads
Complete Tutorials