Git operation manual – git tag is a milestone in time

Time:2021-10-14

catalogue

  • Why is it necessary to use git tag?
  • Basic operation of GIT tag
  • Classification of GIT tag

    • Lightweight label
    • Create a label with a description
  • The role of GIT tag
  • So here comes the question…?

Why is it necessary to use git tag?

There is one for each submissioncommitID, but every timecommitIDAre very complex, usegit tagYou can add a logo to some important versions and modifications, and you can quickly find the version we need.

git tagandgit commitIDThe role of andIPThe function of address and domain name is the same, onegit tagCorresponding to onecommitID, the naming cannot be repeated.

Git operation manual - git tag is a milestone in time

Basic operation of GIT tag

  • View all labels and assign labels
#All labels
git tag
git tag -l
#Specify label
git tag -l <tagName>
  • At the latest of the current branchHEADPut a new label on the
git tag <name>
  • It doesn’t matter if you forget to label, you can give it to the corresponding onecommitIDLabel
git tag <name> <commitID>

Git operation manual - git tag is a milestone in time

Git operation manual - git tag is a milestone in time

  • Delete local label
git tag -d <tagname>

Git operation manual - git tag is a milestone in time

Classification of GIT tag

Lightweight label

git tag <tagName>

Create a label with a description

git tag -a <tagname> -m "message"
#Use - A to specify the label name, and - m to specify the description text

If only enteredgit tag -a <tagname>The input box will pop up and let you take the initiative to enter the description text.

Git operation manual - git tag is a milestone in time Git operation manual - git tag is a milestone in time

The difference between the two is that we usegit showWill the instructions be displayed when you are ready.

Git operation manual - git tag is a milestone in time

The role of GIT tag

effect practice
1. Branch switching can be performed quickly Git operation manual - git tag is a milestone in time
2. Version rollback can be performed quickly Git operation manual - git tag is a milestone in time
  1. All others can be usedcommitIDEverything is done withtagReplace completion-

So here comes the question…?

If branch name andtagWhat happens when the names are the same?

You can check. There should be a conflict.