Home >Development Tools >git >How to rename tag in git
In git, you can use the "git tag new tag name old tag name" command to rename the tag; the function of the tag is to mark a dot as the version number. After using this command to rename the tag, the original old tag The name still exists, just use the "git tag -d tag name" command to delete the old tag name.
The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.
Enter the project folder
git tag Check the tag name
You can see my first tag, let’s do this Make changes
git tag v3.0 v1.0
to rename tag
git tag View results
1. The new tag name is written in front
2. The old tag name still exists, just delete it
Extended knowledge:
Common instructions for tags
The tags in GIT are divided into two types, one is lightweight tag (lightweight tag) and the other is annotation tag ( annotated tag). The following are some commonly used tag-related commands:
git tag
$ git tag v2.1
git tag can take a -l parameter and supports wildcards
For example:
git tag -l version1.*
This way Only versions 1. and a few will be listed.
git tag -l v*
In this way, only versions starting with v will be listed.
View the details of a tag
$ git show v1.4 tag v1.4 Tagger: Scott Chacon Date: Mon Feb 9 14:45:11 2009 -0800 my version 1.4 commit 15027957951b64cf874c3557a0f3547bd83b3ff6 Merge: 4a447f7… a6b4c97… Author: Scott Chacon Date: Sun Feb 8 19:02:46 2009 -0800 Merge branch ‘experiment’Delete tag
Delete the tag of the local warehouse
Command:
git tag -d v2.0
The tag named v2.0 was deleted.
Recommended learning: "
Git TutorialThe above is the detailed content of How to rename tag in git. For more information, please follow other related articles on the PHP Chinese website!