How to Use Git Tags Updated on November 11, 2021 by Christopher Maiorana 2 Minutes, 41 Seconds to Read Throughout the life of your project, you will reach various milestones. With Git, you mark significant improvements and modifications with commits, but often there will be events that will require more annotation, such as version changes. In this article, you’ll learn about how to use tags in Git to mark significant events in the life of your project. You can also use these tags as references to which you can reset your project. But why use tags? Tags are one of the many different options you have in Git for providing additional context around improvements and modifications you make to your files over time, and they are relatively easy to use, understand, and integrate into your workflow. How to Add a Lightweight TagHow to Add an Annotated TagNow That You Know All About Git Tags… If you are new to Git, be sure to check out our guide on learning Git. Before proceeding with tagging, we will want to highlight the different types of tags available. There are two main tag types: lightweight and annotated. For a quick tag, merely a reference to a certain commit, the lightweight tag is sufficient. However, the annotated tag is recommended because it contains more detailed metadata that might be helpful to you later. How to Add a Lightweight Tag Adding a lightweight requires only a quick and easy “tag” command with no options: git tag v1.0 Now, a tag of “v1.0” will reference the most recent commit. To use this tag as a reference use this command: git show v1.0 This output of this command will be a display of the commit referenced and changes that were made in that commit. The below command line output demonstrates this: christopher@server $ git show v1.0 commit 0659595374f673bdffcc5a9d8b08efb145834132 Author: ChristopherM <[email protected]> Date: Wed Nov 1 10:13:25 2020 -0400 Improved database connection You can see this output provides you with a decent amount of information including: the Git user, commit has, and date, as well as the commit message. How to Add an Annotated Tag In order to add an annotated tag, you will use the same “tag” command. However, there are a few options to add in this case. Use the -a option to make this tag “annotated” and the -m command to provide the tag with a message (similar to a commit message). git tag -a v1.2 -m "my version 1.2" Then, to show the output of this tag’s reference, us the Git “show” command again, as in the below command line instance: christopher@server $ git tag -a v1.2 -m “my version 1.2“ christopher@server $ git show v1.2 tag v1.2 Tagger: ChristopherM <[email protected]> Date: Wed Nov 1 16:08:36 2017 -0400 my version 1.2 commit 0659595374f673bdffcc5a9d8b08efb145834132 Author: ChristopherM <[email protected]> Date: Wed Nov 1 10:13:25 2020 -0400 Added new test feature Well done! You now know how to add tags with Git. For more exhaustive detail, check out the complete documentation on Git tags. Now That You Know All About Git Tags… Check out these other resources from the Support Center: Using Git to Publish FilesHow to Create Your Own Git ServerGit Hooks (and How They Work) Share this Article CM Christopher Maiorana Content Writer II Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog. More Articles by Christopher Related Articles How to Host a Static Site with GitHub Pages Publish Your Lovable Created React WebApp to InMotion Hosting Shared Hosting via GitHub How to Publish Your Lovable Created React WebApp to UltraStack ONE for React Git Checkout Command – How To Switch To Branches and Commits How to Create Your Own Git Server Using Git to Publish Files How to Create a New Account with GitHub How to Commit Changes in Git How to Sign Tags and Commits with Git Git Fundamentals Complete Beginner Guide