Home > Development Tools > git > How to rename tag in git

How to rename tag in git

WBOY
Release: 2022-06-30 17:31:54
Original
8020 people have browsed it

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.

How to rename tag in git

The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.

How to rename the tag in git

Enter the project folder

git tag Check the tag name

You can see my first tag, let’s do this Make changes

How to rename tag in git

git tag v3.0 v1.0

to rename tag

How to rename tag in git

git tag View results

How to rename tag in git

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 : Add a lightweight tag to the commit record where the current branch is located.

  • ##git tag : Add a lightweight tag to a specific commit record.

  • ##git tag -a -m : Add an annotation tag to the submission record where the current branch is located.
  • git tag: List all tag names.
  • git tag -d : Deleting a tag is essentially removing the corresponding file in .git/refs/tags/.
  • git show : Displays the specific information of the submission record corresponding to the tag.
  • git push : Push a tag to the remote warehouse.
  • git push --tags: Push all tags to the remote warehouse.
  • git push --delete : Delete a tag in the remote warehouse.
  • List tags
$ git tag
v2.1
Copy after login

git tag can take a -l parameter and supports wildcards

For example:

git tag -l version1.*
Copy after login

This way Only versions 1. and a few will be listed.

git tag -l v*
Copy after login

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’
Copy after login

Delete tag

Delete the tag of the local warehouse

Command:

git tag -d v2.0
Copy after login

The tag named v2.0 was deleted.

Recommended learning: "

Git Tutorial

"

The 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!

Related labels:
git
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template