Enroll in Selenium Training

In the Git section of this course, the tutorial about Tags In Git highlighted the importance of Tags in the Git world. They are vital when we need to show the releases and tag-specific commits. Their frequent use in Git has made them quite popular. But, this tutorial does not talk about Git. Tags are much more than tagging the commits as we did in Git. Tags connect and reveal much more information when we look at them on another platform. This tutorial is about Tags concerning GitHub, the remote repository we have been using in this course to use with Git. An overview would look like:

  • What are Github Tags?
    • Tags As A Timeline Of The Remote Repository.
    • What do Tags Reveal on GitHub?
  • How to Edit and Delete Tags on GitHub?

What are GitHub Tags?

Tags in GitHub have occupied the position at the main header bar along with commits, branches, packages, etc.

tag icon in GitHub

When you click on the highlighted tab showing three releases, the tag page opens up.

github tag tab

We will come back to this after a few minutes once I show you a change in the repository dashboard. Did you notice a new tab has appeared in the branch dropdown after creating the tags? No? Let me show it to you.

branch dropdown tag added

Yes, Tags have appeared in the branch dropdown along with the branches.

Tags As A Timeline Of The Repository

GitHub Tags can help us see the repository at different "important" times in GitHub. Clicking on Tags (as I have done in the above screenshot), will show a list of all the tags in the reverse chronological order, i.e., the latest created tag will be on the top.

Select any one of the tags from the list.

selecting a tag in dropdown

The repository will refresh now. Now the image of the repository you see is till the point of creation of the tag. For example, see the latest commit now.

latest commit github tags

Compare this to when I had not selected the tag.

latest commit original

They are different. So, a tag takes the repository back to the time of its creation. It makes your job easier when all you want to see is how did your repository look when the creation of the tag happened during that release. During any time while you are checking and going through the snapshot of that time, you can change it concerning any other tag or any other branch.

Let's get back to the tabs of Release and Tags that we mentioned briefly at the start of this tutorial. Currently, both Release and Tags will show you the same story, and it might look like they are both similar.

release and github tags

Although they have minor differences, of course, we are going to leave the release tab as of now. We will discuss this in the tutorial about Releases In GitHub.

Let's focus on the Tag part for now.

What do Tags Reveal In GitHub?

A single tag will display five essential pieces of information.

Github tag displays five essential pieces of information

  1. Name Of The Tag: The first and foremost is the name of the tag.
  2. Time Of Creation: It is the time elapsed since the creation of the tag. In our case, it's two days.
  3. Hash Code: This is the hash code of the commit to which the tag is "tagged". In simpler words, this is the last commit up to which this tag can represent the repository.
  4. Zipped Source Code: This is the zip file of the code up to that tag commit only.
  5. Tarball Source Code: This is the tarball of the code up to that tag commit only.
  6. Create Release: This menu bar will help you create a release in GitHub.

Besides the name of the tag, three dots would appear.

github tag commit message

These dots represent the commit message of that tag commit. Click on the dots to open the commit message.

tags commit message open

We can now explore the tag by clicking on the tag name.

For this section, I will be going ahead with the v1.1 tag. Click on the tag, and the tag screen would open.

tag screen

We already discussed all the details shown on this page in the above section. In addition to them, this page throws a new line "1 commit to dev since this tag". This line tells us how many commits are complete on this branch since the creation of the tag.

Please note that the tag has been created on the "dev" branch only. So, if we move on to the master branch, the tags won't be visible in Git or on GitHub. It is the reason that the "dev" branch reference is taken care of here.

Click on this line to view the commit history that has taken place after this tag.

commit since tag

Here you can see the commit history after the creation of the tag. As highlighted in the image above, a commit can be seen, which was done long after the tag creation.

How to Edit And Delete Tags?

Moving ahead with the tags, you can also edit or delete the tag as per your choice from this screen.

edit del tag

Clicking on the Edit tab takes us to the Release screen of the repository. Here, you can publish the release by editing the description and the name of the tag. It has an explanation in Releases in the GitHub tutorial.

Clicking on the delete will delete the tag permanently. You will get a prompt before confirming since it is an irreversible decision.

delete tag confirm

So, tags in GitHub tells a better story about themselves and the repository. Through tags, we can get a proper timeline of the repository along with the source code up to that point, which is very convenient. Tags also are attached to another concept called Releases in GitHub. Releases help in providing the release notes to the team in every release, i.e., in every tag that we create. We can update and delete it like any other tag. In the next tutorial, we will create a couple of release notes and try to update them through GitHub.

Common Questions On GitHub Tags

Can I add Tags directly in GitHub?

Yes, we can add tags directly to GitHub. To sync the same with your local repository, you need to pull the changes using Git. For more details on pulling the changes, refer Git Pull tutorial.

Are tags and releases the same on GitHub?

No, tags do not necessarily define a release of the software, whereas Releases do. Therefore, they differ from each other. But, if there have been no Releases in your GitHub repository, tags and release correspond to the same data, i.e., they look alike.

Can I create a Release directly from the Tag in GitHub?

Yes, releases can be created directly from the tags that are available in your repository. In addition to this, you can also create a fresh release in GitHub.

Can deleted tags be recovered in GitHub?

No, there is no option to recover the deleted tags in Git or GitHub.

Git Delete Tag and Git Update Tag
Git Delete Tag and Git Update Tag
Previous Article
Github Releases
Github Releases
Next Article
Harish Rajora
I am a computer science engineer. I love to keep growing as the technological world grows. I feel there is no powerful tool than a computer to change the world in any way. Apart from my field of study, I like reading books a lot and developing new stuff.
Lakshay Sharma's Photo
Lakshay Sharma

Similar Articles