Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are two types of tags in Git: “lightweight” and “annotated”.</p> <p>Lightweight tags are simply refs in the <code>refs/tags/</code> namespace that point to some other object. They are created by using <code>git tag &lt;tagname&gt; [object]</code> without <code>-a</code>, <code>-m</code>, <code>-F</code>, <code>-s</code>, or <code>-u</code>.</p> <p>Annotated tags are actually a separate kind of Git object (a <a href="http://www.kernel.org/pub/software/scm/git/docs/gitglossary.html#def_tag_object">tag object</a>) that point to some other object. Tag objects store committer information, author information, a message (similar to <a href="http://www.kernel.org/pub/software/scm/git/docs/gitglossary.html#def_commit_object">commit objects</a>) and they point to any single other object (different from commit objects in that commits point to exactly one <a href="http://www.kernel.org/pub/software/scm/git/docs/gitglossary.html#def_tree_object">tree object</a> and zero or more other commit objects).</p> <p>When you have an annotated tag, you usually also have a ref that points to it. Technically this ref is itself a “lightweight” tag, but we usually do not describe them separately.</p> <p>Normally, both kinds of tags point to commits, but they can point to any kind of Git object (tag, commit, tree, or blob). The <a href="http://git.kernel.org/?p=git/git.git;a=summary"><code>git.git</code> repository</a> has <a href="http://git.kernel.org/?p=git/git.git;a=tag;h=6019c27d966fe3ce8adcc0e9f12078eef96ca6ef"><code>refs/tags/junio-gpg-pub</code></a> that points to a blob that contains the maintainer’s GPG public key. Also, <a href="http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=summary"><code>torvalds/linux-2.6.git</code></a> has <a href="http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=tag;h=5dc01c595e6c6ec9ccda4f6f69c131c0dd945f8c"><code>refs/tags/v2.6.11</code></a> that points to a tree. Although tags that point to non-commit objects are technically allowed, they may break or confuse some tools, so they should be avoided, if possible.</p> <hr> <p>The syntax <code>^{}</code> suffix (described in <a href="http://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html#_specifying_revisions"><em>gitrevisions(7)</em></a>) is the tag dereferencing syntax (sometimes called the “peeled tag” syntax). For tag objects, it evaluates to the first non-tag object to which the tag object points (it will recursively deference a chain of tag objects until it finds a non-tag object). For non-tag objects, it means the same thing as without the <code>^{}</code> suffix.</p> <p>The <code>refs/tags/Prod_Release_2.3</code> ref in your central repository points to the tag object named <code>30bd19ef190cf664356c715b56044ce739f07468</code>.<br> That tag objects ultimately points to some other non-tag object named <code>4ae15ee04c2c41bfc7945e66f4effc746d52baec</code> (probably a commit). </p> <p>Thus, <code>refs/tags/Prod_Release_2.3^{}</code> resolves to <code>4ae15ee04c2c41bfc7945e66f4effc746d52baec</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. COIn short, each _annotated tag_ you push creates an initial tag reference and a second reference with the ^{} syntax that points to the first one. Lightweight tags only create a single reference.
      singulars
    2. CO@bryanbraun: The `whatever^{}` name does not exist as a *ref* (an entry under the `refs/` namespace); `^{}` is simply a suffix that can be appended to any revision name (*ref* name, (abbreviated) *object* hash, or other computed revision name, etc.) to “peel” *tag objects* until a non-tag *object* is found. Assuming the *commit* to be tagged, **C**, has already been pushed, then pushing a new annotated tag would push one *tag object* (pointing to **C**) and a new *ref* (pointing to the new *tag object*), while a lightweight tag would push only the new *ref* (pointing to **C**).
      singulars
    3. COAlthough `ls-remote` shows these `^{}` psuedo-*refs*, they do not actually exist as *refs*; you can verify this by (e.g.) comparing the output of `git show-ref --tags` (actual tag *refs*) to that of `git ls-remote --tags .` (what the “wire protocol” reports). The “peeled tags” are included in the “wire protocol” for technical reasons, but they do not exists as actual *refs*. But yes, you can think of the `^{}` ones as “references” (since it is a way of naming a particular object) as long as you do not use that term to mean “an entry under the `/refs` namespace”.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload