Sample - GitHub REST API
PATCH/repos/{owner}/{repo}/git/refs/{ref}

Update a reference

Updates the provided reference to point to a new SHA. For more information, see "Git References" in the Git documentation.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

3 parameters · 2 body fields
ownerstringrequired
The account owner of the repository. The name is not case sensitive.
repostringrequired
The name of the repository without the `.git` extension. The name is not case sensitive.
refstringrequired
The Git reference. For more information, see "[Git References](https://git-scm.com/book/en/v2/Git-Internals-Git-References)" in the Git documentation.
shastringrequired
The SHA1 value to set this reference to
forcebooleanoptional
Indicates whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to `false` will make sure you're not overwriting work.
Default:false

3 status codes
200Response
refstringrequired
node_idstringrequired
urlstringrequired
objectobjectrequired
409Conflict
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Validation failed, or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 409 is returned: Conflict. A 422 is returned: Validation failed, or the endpoint has been spammed.