diff options
Diffstat (limited to 'doc/api/commits.md')
-rw-r--r-- | doc/api/commits.md | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/doc/api/commits.md b/doc/api/commits.md index 63554c63057..3c12906def4 100644 --- a/doc/api/commits.md +++ b/doc/api/commits.md @@ -198,6 +198,39 @@ Example response: } ``` +## Get references a commit is pushed to + +> [Introduced][ce-15026] in GitLab 10.6 + +Get all references (from branches or tags) a commit is pushed to. + +``` +GET /projects/:id/repository/commits/:sha/refs +``` + +Parameters: + +| Attribute | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user +| `sha` | string | yes | The commit hash | +| `type` | string | no | The scope of commits. Possible values `branches`, `tags`, `all`. Default is a `all`. | + +```bash +curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" --form "type=all" "https://gitlab.example.com/api/v4/projects/5/repository/commits/5937ac0a7beb003549fc5fd26fc247adbce4a52e/refs" +``` + +Example response: + +```json +[ + {"name": "'test'"}, + {"name": "master"}, + {"name": "v1.1.0"} +] + +``` + ## Cherry pick a commit > [Introduced][ce-8047] in GitLab 8.15. @@ -500,3 +533,4 @@ Example response: [ce-6096]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6096 "Multi-file commit" [ce-8047]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8047 +[ce-15026]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15026 |