Git clone command approaches the repository through a remote URL. It accesses the repository through a remote URL. Generally, the primary repository is located in a remote server, frequently from a Git service like GitHub, Bitbucket, or GitLab. The remote repository URL is mentioned to the source.
$ git clone
You have to follow the below steps to add a tag to a previous commit in a Git repository that you have cloned locally:
1. To clone the repository to your local machine you have to use the git clone command.
For example:
git clone https://github.com/user/repo.git
2. Set the path to the directory where the repository was cloned using the cd command.
3. Using the git log command view the commit history and find the hash of the commit you want to tag.
4. Add the tag to the specific commit using the git tag command.
For example:
git tag my-tag
5.To push the tag to the remote repository, use the git push command with the --tags option.
For example:
git push --tags
The above command will push the tag to the remote repository so that other users also able to see it.
6. You are also able to specify a specific tag to push, as follow:
git push my-tag
Comments (0)