Web Tutorials

Git Tagging

As you progress in project development, it is indeed optional to learn Git tagging. But knowing how to use tags in Git may serve as a future reference. Git tagging is a step in project development to mark a new milestone of that project. It’s top priority to is to mark versions of your project.

Why are they used?

Let’s say you’ve finished developing your entire project. And you want to mark this part of your development as fully-operational. To mark the current state of your project you have to use tags. Most lead developers tag their projects first before releasing them to the public. This is where the “version control” part of VCSs are implemented. Lead developers would tag projects by version names.

v1.0, v1.2.1, v1.2.2…

These tags then represent a part of the project that is stable and can therefore be released to the public. Some versions may also differ in functionality and bugs with each new version.

What else do tags do?

Tags are really just used to mark different versions of your project. However, there are two different tags used for different purposes.

1. Lightweight Tags

Lightweight tags are the default kind of tags. They only mark versions of your project’s commits and declare its version.

2. Annotated Tags

Annotated tags are just like lightweight tags but with more information. With annotated tags, you can specify a message along with that tag, sign with a GPG key (depending on your email address associated), and other meta-descriptions.

How to tag a commit?

Tagging requries the lead developer’s approval before tagging the project’s latest commit. This ensures that the project’s state is now stable and can be released to the public. Then, the lead developer is now responsible for tagging the latest commit. The lead developer must now open the directory of his/her local repository and input into the command line:

#Lightweight tagging
git tag version_name
#Annotated tagging
git tag -a version_name -m "Message"

The lead developer must decide on which tag to use before tagging. After that, the tag is now successfully marked on the side of the latest commit’s SHA1. However, this is only done on the local repository of the lead developer. Therefore, the lead developer has to commit and push the new tag to the origin/master branch.

[OPTIONAL] To check the success of the new tag enter into the command line below:

git tag

NOTE: Tags are only found and used on the origin/master branch.

The process of pushing tags to the origin/master branch is the same for any commit. Learn how to create commits here.

Finally, check if the new tag is found at the latest commit of your origin/master branch.

8 thoughts on “Git Tagging

  1. Hi, Neat post. There’s a problem with your web site in internet explorer, would test this?IE still is the market leader and a good portion of people will miss your magnificent writing due to this problem.

  2. What抯 Happening i’m new to this, I stumbled upon this I’ve found It positively useful and it has helped me out loads. I hope to contribute & aid other users like its helped me. Great job.

  3. Fantastic website you have here but I was wondering if you knew of any community forums that cover the same topics discussed here? I’d really love to be a part of online community where I can get comments from other knowledgeable individuals that share the same interest. If you have any recommendations, please let me know. Thanks!

    1. I’m sorry but I don’t know of any community forums that may help you with your interests because I myself don’t use community forums. I hope you find what you’re looking for 🙂

  4. Do you mind if I quote a couple of your posts as long as I provide credit and sources back to your blog? My blog site is in the exact same area of interest as yours and my visitors would really benefit from some of the information you provide here. Please let me know if this alright with you. Regards!

    1. Sorry for such a late reply. I have been busy with some school works and haven’t had the time to update my website. Of course it’s fine! I have no problem with my website to be sourced for as long there is credit along with it. Thank you so much for reading my blogs! 🙂

Leave a Reply

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