简体   繁体   中英

What is the mean of ^{} in git ls-remote?

What is the meaning of the symbol ^{} ?
If I check with git log or github the tag reference to the commit in the lines with this symbol, so what is the duplicate object without this symbol.

Example

2191702bddc9438e2e8beda602972fdb87a73a15        refs/tags/V1.0
0bfeb6f7a1d2789b3e3d9944edbe680cd7355b6a        refs/tags/V1.0^{}
6bde933efef11bbc75f71df2111b146748220ad8        refs/tags/V2.0
de33c8da37dba18f8d134f6a2a4c1e70da5593ae        refs/tags/V2.0^{}

These are annotated tags.

The other type, a lightweight tag, is a name that refers to a commit. The tag itself doesn't exist as a separate object in the git repository, but it's just an alternative name for a normal commit object.

You would just have 1 line for each such tag in your listing there, something like:

1234567890c9438e2e8beda602972fdb87a73a15        refs/tags/lightweight

As a git graph you could think of something like this:

                       master
                         v
*----*----*----*----*----*
                    ^
                  v9.1

However, the presence of two lines, one of them with that ^{} syntax, means that these tags are annotated tags.

These exist as their own separate objects in the git repository and also refer to a regular commit object.

So with these two lines:

2191702bddc9438e2e8beda602972fdb87a73a15        refs/tags/V1.0
0bfeb6f7a1d2789b3e3d9944edbe680cd7355b6a        refs/tags/V1.0^{}

This means that the annotated tag object is in the object with id 2191702... , whereas that tag object refers to commit 0bfeb6f7a... .

                       master
                         v
*----*----*----*----*----*
                    |
                 tag-object
                    ^
                  V1.0

TL,DR: Lightweight tags would show only the first line, the presence of the second line means these are annotated tags where the tag-name refers to an annotated tag object, and the second reference with ^{} denotes the commit the tag refers to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM