> ## Documentation Index
> Fetch the complete documentation index at: https://code.storage/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# repo.getCommit()

> Get metadata for a single commit without computing its diff.

> [!WARNING]
>
> This page documents the earlier Code Storage SDKs: `@pierre/storage`, `pierre-storage`, and
> `code-storage-go`. New code uses the [Pierre SDK](https://code.storage/docs/sdks.md). To move code to the new SDK, use the
> [`pierre-migrate`
> skill](https://github.com/pierrecomputer/skills/tree/main/skills/pierre-migrate).

```typescript TypeScript theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
const { commit } = await repo.getCommit({
  sha: 'abc123def456...',
});

console.log(commit.message);
console.log(`${commit.authorName} <${commit.authorEmail}>`);
console.log(commit.parentShas);
console.log(commit.date.toISOString());
```

```python Python theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
result = await repo.get_commit(sha="abc123def456")
commit = result["commit"]

print(commit["message"])
print(f"{commit['author_name']} <{commit['author_email']}>")
print(commit["parent_shas"])
print(commit["date"].isoformat())
```

```go Go theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
result, err := repo.GetCommit(context.Background(), storage.GetCommitOptions{
	SHA: "abc123def456",
})
if err != nil {
	log.Fatal(err)
}

fmt.Println(result.Commit.Message)
fmt.Printf("%s <%s>\n", result.Commit.AuthorName, result.Commit.AuthorEmail)
fmt.Println(result.Commit.ParentSHAs)
fmt.Println(result.Commit.Date.Format(time.RFC3339))
```

## Options

**sha** `string` *required*

Commit SHA to fetch metadata for. Any revision Git can resolve is accepted (full SHA, short SHA,
branch name, tag).

## Response

**commit** `object`

Commit metadata. Extends the shape returned by `listCommits()` with two signature fields that are
only populated on this single-commit endpoint.

The `commit` object contains:

* `sha`
* `parentShas` — parent commit SHAs in Git parent order; empty for root commits. Python:
  `parent_shas`; Go: `ParentSHAs`.
* `message` — the full commit message, with the body and the trailers. `listCommits()` returns only
  the subject line.
* `authorName`, `authorEmail`
* `committerName`, `committerEmail`
* `date` (parsed `Date` in TypeScript, `datetime` in Python, `time.Time` in Go)
* `rawDate` (RFC 3339 string as returned by the server)
* `signature` — the armored signature taken from the commit's signature header. Omitted for unsigned
  commits.
* `payload` — the exact bytes the signature is computed over. Omitted for unsigned commits.

The `signature`/`payload` pair mirrors GitHub's commit `verification` object, so you can verify a
signature yourself by checking `signature` against `payload`:

```typescript TypeScript theme={null} theme={"theme":{"light":"github-light","dark":"min-dark"}}
const { commit } = await repo.getCommit({ sha: 'abc123def456' });

if (commit.signature) {
  // `commit.payload` is the data the signature was computed over.
  verifyOpenPGP(commit.payload, commit.signature);
}
```

## Notes

* This endpoint does not compute or return the commit diff. Use
  [`getCommitDiff()`](https://code.storage/docs/sdk/repos/diff-get) when you need file changes as well.
* For listing many commits at once, prefer [`listCommits()`](https://code.storage/docs/sdk/repos/commits-list) — the
  per-commit shape is identical except that `signature` and `payload` are only returned by
  `getCommit()`.
* `signature` and `payload` let a client check a commit signature. See
  [Commit Signing](https://code.storage/docs/repos/commit-signing.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.