DELETE/repos/{owner}/{repo}/git/refs/{ref}

Delete a Git reference

Deletes a Git reference from a repository. Use owner and repo to identify the repository and ref to select the reference to remove. The default branch cannot be deleted.

3 parameters
ownerstringrequired
The account that owns the repository; the name is not case-sensitive.
repostringrequired
The repository name without the `.git` extension; the name is not case-sensitive.
refstringrequired
The Git reference to delete.

3 status codes
204Returns no response body; the reference was deleted.
409Returned when deleting the reference conflicts with the repository's current state.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when an attempt is made to delete the default branch or the endpoint has been spammed.

Error handling

A 409 indicates a conflict while deleting the reference identified by the ref path parameter in the repository identified by the owner and repo path parameters. A 422 is returned when you attempt to delete the default branch or the endpoint has been spammed; do not target the default branch or send repeated requests.