89

I stumbled upon two odd characters at the end of a git ls-remote command and I wonder what this means?

0e4c39557ccb6789173c refs/tags/2011-11-04 966f8df553f18c486820 refs/tags/2011-11-04^{} 

Do you happen to know what this ^{} means? Also, why does this git tag seems duplicated?

2 Answers 2

77

The ^{} notation is explained in the gitrevisions manual:

<rev>^{}, e.g. v0.99.8^{} 

A suffix ^ followed by an empty brace pair means the object could be a tag, and dereference the tag recursively until a non-tag object is found.

In this case - refs/tags/2011-11-04 is the tag that points to the tag object 0e4c39557ccb6789173c. By doing refs/tags/2011-11-04^{} we can dereference the tag to the final non-tag object, which in this case is - 966f8df553f18c486820 (a commit). Note that ^{} is a noop when applied to non-tag objects.

The git show-ref command can be use to see tags as well as the final dereferenced non-tag objects:

$ git show-ref --tags 3521017556c5de4159da4615a39fa4d5d2c279b5 refs/tags/v0.99.9c 423325a2d24638ddcc82ce47be5e40be550f4507 refs/tags/v1.0rc4^{} $ git show-ref --tags --dereference 3521017556c5de4159da4615a39fa4d5d2c279b5 refs/tags/v0.99.9c 6ddc0964034342519a87fe013781abf31c6db6ad refs/tags/v0.99.9c^{} 055e4ae3ae6eb344cbabf2a5256a49ea66040131 refs/tags/v1.0rc4 423325a2d24638ddcc82ce47be5e40be550f4507 refs/tags/v1.0rc4^{} 

From the git show-ref manual:

-d --dereference 

Dereference tags into object IDs as well. They will be shown with "^{}" appended.

Sign up to request clarification or add additional context in comments.

1 Comment

A more complete explanation can be found in this duplicate question: stackoverflow.com/a/15472310/83284
19

Note that git ls-remote has new filter with git 2.8 (March 2016).

See commit 99c08d4, commit ba5f28b, commit 80b17e5, commit 40a8852, commit 54813bd (18 Jan 2016) by Thomas Gummerer (tgummerer).
Suggested-by: pedro rijo (pedrorijo91).
(Merged by Junio C Hamano -- gitster -- in commit bd6934a, 03 Feb 2016)

That means you can show only the tags with

git ls-remote --refs 

Do not show peeled tags or pseudorefs like HEAD in the output.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.