Git does not have push locally, and the local warehouse only pushes the tag after hitting the tag. is the latest code under the tag in the remote warehouse?
This question is very interesting and simple, as long as you actually operate it, you can find that the code under the tag is up to date. However, to understand why, one needs to understand what is in Git.ObjectAndQuoteThese two concepts.
Git has four types of objects:data object（blob object）、Tree object（tree object）、Submit object(commit object) andLabel object（tag object）。 The tag object is very similar to the submission object and can be understood as a reference to the submission object. Every time we run the git add and git commit commands, we actually save the rewritten files as data objects and tree objects, and create a tree object whose commit object points to the top level. these objects are saved in the
.git/objectsUnder the directory.
Secondly, Git has three types of references:HEAD reference、Label referenceAndRemote reference, they were saved in
refs/remotesUnder three directories. HEAD references represent code branches that you create, and tag references represent all tags that you create. You can open the files in three directories to see, in fact, it is a plain text file, which records the SHA-1 hash value of the submitted object (or label object), representing which submission the reference points to.
Therefore, when you push a tag to the remote warehouse, it is in the remote warehouse.
refs/tagsCreate a tag reference under the directory that points to a submission object that will be packaged and sent to the server because you haven’t push yet. However, since the HEAD reference has not been updated, this submission cannot be seen at any branch of checkout, and can only be seen at the specified tag.