In this tutorial, I will show you how to rename a tag in GIT into a new name!
Assume, I have a project questions-management on GitHub and this project has a following tag:
Now, I will rename the tag example_tag into tag example!
To do this thing, first of all, you must clone the remote repository into local machine, then using some following GIT commands:
- Rename tag in local machine:
Syntax:
1 |
git tag <new_name> <old_name> |
With my example, the command should be as below:
1 |
git tag example example_tag |
With this command, GIT will create a new tag with name example, the example_tag remains the same.
- Now, we will delete the tag example_tag.
To delete a tag in GIT, you can reference the article at https://huongdanjava.com/en/delete-a-tag-in-git.html.
With this example, my delete steps will be as below:
- Finally, update all tags.
1 |
git push origin --tags |
After this step, you can check the result: