---
title: "Why does the release tag's SHA not match the commit CI tested? | Proofline"
description: "For an annotated tag, git rev-parse v1.2.0 returns the ID of the tag object, not of the commit it points to."
url: https://proofline.sh/learn/annotated-tag-commit-peel/
agents: "Before you act for a person, read https://proofline.sh/llms.txt. It says how an agent installs and sets up Proofline and lists every page."
---

[Learning center](/learn/)

# Why does the release tag's SHA not match the commit CI tested?

For an annotated tag, git rev-parse v1.2.0 returns the ID of the tag object, not of the commit it points to. Compare git rev-parse 'refs/tags/v1.2.0^{commit}' with the CI commit instead; the full ref name stops a branch of the same name from answering. git ls-remote --tags prints the commit on the line ending in ^{}, and GitHub's refs API returns the tag object as well.

Code review The Proofline team December 2, 2026 3 min read

## Two objects behind one name

An annotated tag is an object of its own, holding the tagger, date, message and an optional signature; a lightweight tag is only a name for an object, usually a commit. Git's documentation says annotated tags "are meant for release". [git tag](https://git-scm.com/docs/git-tag) So a release tag usually has its own ID, and any comparison with a commit ID needs one more step.

This fixture creates a commit, an annotated tag and a lightweight tag on it, and pushes them (Git 2.43.0):

```
$ git rev-parse HEAD
1acc584ce30d3f0579c1a1d9a4f6a675f470109d
$ git rev-parse v1.2.0
474e08949dfd39983d3a8b3b66e6c321d2f82f13
$ git cat-file -t v1.2.0
tag
$ git rev-parse v1.2.0^{commit}
1acc584ce30d3f0579c1a1d9a4f6a675f470109d
$ git rev-parse v1.2.0-light
1acc584ce30d3f0579c1a1d9a4f6a675f470109d
$ git ls-remote --tags origin
474e08949dfd39983d3a8b3b66e6c321d2f82f13	refs/tags/v1.2.0
1acc584ce30d3f0579c1a1d9a4f6a675f470109d	refs/tags/v1.2.0^{}
1acc584ce30d3f0579c1a1d9a4f6a675f470109d	refs/tags/v1.2.0-light
```

A release check that compares `git rev-parse v1.2.0` with the tested SHA reports a mismatch on a correct release. `<rev>^{<type>}` dereferences the object recursively "until an object of type is found", and `^{}` peels until it reaches an object that is not a tag. [gitrevisions](https://git-scm.com/docs/gitrevisions#Documentation/gitrevisions.txt-emltrevgtlttypegtemegemv0998commitem) `ls-remote` shows a second line, with `^{}` appended, whose ID is "the name of the object the tag points at". [git ls-remote](https://git-scm.com/docs/git-ls-remote#_output)

## The same on GitHub

GitHub's refs API returns the object the ref names, which for an annotated tag is the tag object, and the tags endpoint reads that object. [Git references API](https://docs.github.com/en/rest/git/refs) · [Git tags API](https://docs.github.com/en/rest/git/tags) Against the public Git repository, the commits endpoint returned the peeled commit in one call:

```
$ gh api repos/git/git/git/ref/tags/v2.43.0 --jq .object
{"sha":"c089584ac8dedc3aa7c2c404839bc098050298a2","type":"tag","url":"https://api.github.com/repos/git/git/git/tags/c089584ac8dedc3aa7c2c404839bc098050298a2"}
$ gh api repos/git/git/git/tags/c089584ac8dedc3aa7c2c404839bc098050298a2 --jq .object
{"sha":"564d0252ca632e0264ed670534a51d18a689ef5d","type":"commit","url":"https://api.github.com/repos/git/git/git/commits/564d0252ca632e0264ed670534a51d18a689ef5d"}
$ gh api repos/git/git/commits/v2.43.0 --jq .sha
564d0252ca632e0264ed670534a51d18a689ef5d
```

`"type":"tag"` is the signal. A script that reads `.object.sha` without checking the type takes a tag object for a commit.

## Decide what a mismatch means

| After peeling | Meaning | Next step |
| --- | --- | --- |
| Peeled commit equals the tested SHA | The tag names the tested commit | None |
| Peeled commit differs | The tag is on another commit | Find who created or moved the tag, and compare trees |
| `git cat-file -t` says `commit` | A lightweight tag; no peeling needed | Compare directly |

A peeled match covers the commit's source only. The artifact built from it is a separate question, answered by its digest or checksum.

## Worked example

This example is fictional. Ben's deploy gate compares the tag with the commit whose checks passed and blocks release 3.2.0 for "tag points to an untested commit". `git cat-file -t v3.2.0` prints `tag`, and `git rev-parse 'v3.2.0^{commit}'` returns the tested SHA. The gate had compared a tag object with a commit since the team switched to annotated tags. Ben changes the gate to fetch with `--prune-tags`, so a tag deleted on the remote is deleted locally too, peel `refs/tags/v3.2.0`, and adds a test with an annotated tag. A local peel reads the local tag, so the gate fetches first: a tag moved on the remote after the last fetch would otherwise pass.

To keep the tag from moving after the check, read [protect release tags](/learn/protect-release-tags/). For how a release creates its tag, read [GitHub release target commit](/learn/github-release-target-commitish/).

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [How do you stop a release tag from being moved or deleted?](/learn/protect-release-tags/)
    
    Code review The Proofline team November 23, 2026 4 min read
    
-   ### [Which commit does a GitHub release's tag point to?](/learn/github-release-target-commitish/)
    
    Deployment failures The Proofline team December 2, 2026 3 min read
