- [HTTP request](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchCommit#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchCommit#body.PATH_PARAMETERS)
- [Query parameters](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchCommit#body.QUERY_PARAMETERS)
- [Request body](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchCommit#body.request_body)
- [Response body](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchCommit#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchCommit#body.FetchGitRepositoryLinkCommitResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchCommit#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchCommit#body.aspect_1)
- [Try it!](https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/projects.locations.connections.gitRepositoryLinks/fetchCommit#try-it)

Fetch Commit details from a Git repository link.

### HTTP request

`GET https://developerconnect.googleapis.com/v1/{name=projects/*/locations/*/connections/*/gitRepositoryLinks/*}:fetchCommit`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` Required. The resource name of the GitRepositoryLink in the format `projects/*/locations/*/connections/*/gitRepositoryLinks/*`. |

### Query parameters

| Parameters ||
|---|---|
| `commitSha` | `string` Required. The commit SHA, or symbolic revision (for example, branch name, tag, or Git reference). |
| `view` | ``enum (`https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/CommitView`)`` Optional. The level of commit details to return in the response. Defaults to `FULL` if unspecified. In `FULL` view, `files` metadata (paths and statuses) are returned; `pathFilters` must also be specified to populate line patch hunks. |
| `pathFilters[]` | `string` Optional. Path patterns or exact paths to filter returned files (only applicable in `FULL` view). When `pathFilters` is specified, `FileDiff.patch` is populated for all matching files (use `["**"]` to include patches for all changed files). When `pathFilters` is omitted or empty, the full list of `FileDiff` is returned without patch diffs (`FileDiff.patch` is empty). |

### Request body

The request body must be empty.

### Response body

Response message for gitRepositoryLinks.fetchCommit.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "commit": { object (`https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/SCMCommit`) }, "files": [ { object (`https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/FileDiff`) } ] } ``` |

| Fields ||
|---|---|
| `commit` | ``object (`https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/SCMCommit`)`` The commit metadata. |
| `files[]` | ``object (`https://docs.cloud.google.com/developer-connect/docs/api/reference/rest/v1/FileDiff`)`` List of file changes and patch diffs. Omitted when view is `BASIC`. Patch diffs (`FileDiff.patch`) are only populated when `pathFilters` is specified in the request. |

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `name` resource:

- `developerconnect.gitRepositoryLinks.fetchCommit`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).