---
title: "Which commit does a GitHub release's tag point to? | Proofline"
description: "If the tag does not exist yet, GitHub creates it from target_commitish."
url: https://proofline.sh/learn/github-release-target-commitish/
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/)

# Which commit does a GitHub release's tag point to?

If the tag does not exist yet, GitHub creates it from target\_commitish. The default is the default branch as it stands at that moment, which may already be past the commit you tested. Pass the tested commit's full SHA, or create the tag yourself and require it. Afterwards, read the commit from the tag, because the release's target\_commitish field is ignored when the tag already exists and may name a branch that does not contain the tag.

Deployment failures The Proofline team December 2, 2026 3 min read

## How the tag gets made

The REST endpoint that creates a release describes `target_commitish` as the value that "determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch." [Create a release](https://docs.github.com/en/rest/releases/releases#create-a-release)

GitHub CLI behaves the same way: "If a matching git tag does not yet exist, one will automatically get created from the latest state of the default branch. Use `--target` to point to a different branch or commit for the automatic tag creation. Use `--verify-tag` to abort the release if the tag doesn't already exist." `--target` takes a branch or a full commit SHA. [gh release create](https://cli.github.com/manual/gh_release_create)

The tag is cut from the branch as it is when the release job runs. If another pull request merges between your last green run and the release job, the tag lands on that newer commit, and nothing in the release fails.

## The release record does not name the commit

Because `target_commitish` is unused for an existing tag, the value stored on the release need not describe the tag. A public release shows the gap (GitHub CLI 2.104.0):

```
$ gh api repos/kubernetes/kubernetes/releases/tags/v1.37.3 --jq "{tag_name, target_commitish}"
{"tag_name":"v1.37.3","target_commitish":"master"}
$ gh api repos/kubernetes/kubernetes/commits/v1.37.3 --jq .sha
f81a9c5f95912fd97b7c8aa4966301aeae84a253
$ gh api repos/kubernetes/kubernetes/compare/master...v1.37.3 --jq "{status, ahead_by, behind_by}"
{"ahead_by":113,"behind_by":3724,"status":"diverged"}
```

The release says `master`, but the tagged commit is not on `master`: the tag's history has 113 commits that `master` lacks. Nothing is wrong with the tag; the field simply does not describe it. Read the tag through the commits endpoint, which peels an annotated tag to its commit, or with `git rev-parse 'TAG^{commit}'`.

## Release the tested commit

Either create the tag from the tested SHA in the release job:

```
gh release create "v$VERSION" --target "$TESTED_SHA" --notes-file notes.md
```

Or push the tag first, then refuse to create one:

```
git tag -a "v$VERSION" "$TESTED_SHA" -m "Release $VERSION"
git push origin "v$VERSION"
gh release create "v$VERSION" --verify-tag --notes-file notes.md
```

In both cases, check the result, because a tag left by an earlier failed attempt makes `--target` a no-op:

```
test "$(gh api repos/OWNER/REPO/commits/v$VERSION --jq .sha)" = "$TESTED_SHA"
```

`TESTED_SHA` should come from the run whose checks you rely on, not from `git rev-parse HEAD` in the release job, which may have checked out a newer branch tip.

## Worked example

This example is fictional. Chen's release workflow runs `gh release create v2.3.0` after the nightly tests pass on `main` at `5e1d0b7`. Between the test run and the release job, Ana's pull request merges. The tag is created on Ana's commit, which no nightly run had tested. The release page shows `main` as the target and gives no sign of the gap. Chen finds it by comparing the tag's commit with the commit of the test run, then changes the workflow to pass `--target` with the tested SHA and to run the check above.

For tags that point to tag objects, read [annotated tags and peeling](/learn/annotated-tag-commit-peel/). To keep a tag from moving later, read [protect release tags](/learn/protect-release-tags/).

## 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

-   ### [Why does the release tag's SHA not match the commit CI tested?](/learn/annotated-tag-commit-peel/)
    
    Code review The Proofline team December 2, 2026 3 min read
    
-   ### [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
