Skip to main content

Get a reference

Returns a single reference from your Git database. The `:ref` in the URL must be formatted as `heads/<branch name>` for branches and `tags/<tag name>` for tags. If the `:ref` doesn't match an existing ref, a `404` is returned. **Note:** You need to explicitly [request a pull request](https://docs.github.com/[email protected]/rest/reference/pulls#get-a-pull-request) to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/[email protected]/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)".

GET/repos/{owner}/{repo}/git/ref/{ref}
Source
github-v3-rest.json
Revision
f5f067c1e6f6
Active snapshot
85e53e3d0d65

Request

Path Parameters
owner string
required
repo string
required
ref string
required

ref parameter

Responses

application/json Git Reference object

Response

node_id string
required
object object
required
sha string
required

SHA for the reference

Example: 7638417db6d59f3c431d3e1f261cc637155684cd

type string
required
url string<uri>
required
ref string
required
url string<uri>
required
application/json Basic Error object

Resource not found

documentation_url string
optional
message string
optional
status string
optional
url string
optional