Reputation: 33
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^{}
Upvotes: 3
Views: 429
Reputation: 1324347
Git 2.42 (Q3 2023) officially documents git ls-remote
output format, including the ^{}
lines:
See commit 51f9d2e, commit a5b0763, commit e959fa4, commit 21c9bac, commit 00bf685 (19 May 2023) by Sean Allred (vermiculus
).
See commit 0f45b5b (19 May 2023) by Junio C Hamano (gitster
).
(Merged by Junio C Hamano -- gitster
-- in commit ebd07c9, 13 Jun 2023)
ls-remote doc
: document the output formatSigned-off-by: Sean Allred
While well-established, the output format of
ls-remote
was not actually documented.
This patch adds anOUTPUT
section to the documentation following the format ofgit-show-ref.txt
(which has similar semantics).Add a basic example immediately after this to solidify the 'normal' output format.
git ls-remote
now includes in its man page:
OUTPUT
The output is in the format:
<oid> TAB <ref> LF
When showing an annotated tag, unless
--refs
is given, two such lines are shown:
- one with the refname for the tag itself as
<ref>
,- and another with
<ref>
followed by^{}
.
The<oid>
on the latter line shows the name of the object the tag points at.
git ls-remote
now includes in its man page:
- List all references (including symbolics and pseudorefs), peeling tags:
$ git ls-remote 27d43aaaf50ef0ae014b88bba294f93658016a2e HEAD 950264636c68591989456e3ba0a5442f93152c1a refs/heads/main d9ab777d41f92a8c1684c91cfb02053d7dd1046b refs/heads/next d4ca2e3147b409459955613c152220f4db848ee1 refs/tags/v2.40.0 73876f4861cd3d187a4682290ab75c9dccadbc56 refs/tags/v2.40.0^{}
And:
ls-remote doc
: show peeled tags in examplesSigned-off-by: Sean Allred
Without
--refs
, this command will show peeled tags.
Make this clearer in the examples to further mitigate the possibility of surprises in consuming scripts.
git ls-remote
now includes in its man page:
485a869c64a68cc5795dd99689797c5900f4716d refs/tags/v2.39.2 cbf04937d5b9fcf0a76c28f69e6294e9e3ecd7e6 refs/tags/v2.39.2^{} d4ca2e3147b409459955613c152220f4db848ee1 refs/tags/v2.40.0 73876f4861cd3d187a4682290ab75c9dccadbc56 refs/tags/v2.40.0^{}
Upvotes: 0
Reputation: 391336
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.
Upvotes: 2