Creating tag with Git
We can also create tags on our GitHub repository using git commands. Now for that we will clone the repository then add tags to that and push that tag to the actual GitHub repository. So we will take the following steps to add tag to our repository-
Step-1: Clone that repository
For that, we will go to the code section and copy the repository URL
After that, we will use following command to clone the repository
git clone {Link of Repository}
Step-2: Use following command to get into the cloned repository
cd {cloned repository name}
Step-3: Use the following command to get details of all the previous commits of that repository
git log
Step-4: Choose the commit on which we want to apply tag. After choosing, copy the Hash of that commit.
Step-5: After that use following command to add the tag
git tag -a {name of tag} {Hash of commit}
Step-6: Now we will get Vim Editor to write a tag message. So after writing tag message we will press ctrl+c and write the following to save that message-
:wq
Step-7: After that push the tag to the original GitHub repository by following command
git push origin {name of tag}
Step-8: Now we can see that tag in the “Tags” section of that GitHub repository
How to Create a Tag in a GitHub Repository?
Tags are one of the important parts of Git and GitHub. We can see in the case of open source projects that the release of a particular version is attached with a tag. Tags are used to memorize a specific moment in history. Even after making multiple changes to the code, we can get back to the particular state of code if it is tagged.
We can create a tag in github repository with the below approaches:
Table of Content
- Creating a Tag in GitHub Repository
- Creating tag with Git