diff options
author | Nick Thomas <nick@gitlab.com> | 2018-11-09 16:33:50 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-11-09 16:33:50 +0000 |
commit | 8d74ef331c4f2d391279f178ebb02c28a56205ac (patch) | |
tree | 4232aed4c18ce449e9db99e93374552a49646051 /doc | |
parent | 57cee17673a711ff023fd1a9766defefd0103a9f (diff) | |
parent | 2331d3af63122e7b2419bce2e5e6e5bdc63cd2d8 (diff) | |
download | gitlab-ce-8d74ef331c4f2d391279f178ebb02c28a56205ac.tar.gz |
Merge branch 'rs-revert-api' into 'master'
Add revert to commits API
Closes gitlab-org/release/framework#48
See merge request gitlab-org/gitlab-ce!22919
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/commits.md | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/doc/api/commits.md b/doc/api/commits.md index 9b7ca4b6e70..994eefa423f 100644 --- a/doc/api/commits.md +++ b/doc/api/commits.md @@ -288,6 +288,47 @@ Example response: } ``` +## Revert a commit + +> [Introduced][ce-22919] in GitLab 11.6. + +Reverts a commit in a given branch. + +``` +POST /projects/:id/repository/commits/:sha/revert +``` + +Parameters: + +| Attribute | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | +| `sha` | string | yes | Commit SHA to revert | +| `branch` | string | yes | Target branch name | + +```bash +curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" --form "branch=master" "https://gitlab.example.com/api/v4/projects/5/repository/commits/a738f717824ff53aebad8b090c1b79a14f2bd9e8/revert" +``` + +Example response: + +```json +{ + "id":"8b090c1b79a14f2bd9e8a738f717824ff53aebad", + "short_id": "8b090c1b", + "title":"Revert \"Feature added\"", + "created_at":"2018-11-08T15:55:26.000Z", + "parent_ids":["a738f717824ff53aebad8b090c1b79a14f2bd9e8"], + "message":"Revert \"Feature added\"\n\nThis reverts commit a738f717824ff53aebad8b090c1b79a14f2bd9e8", + "author_name":"Administrator", + "author_email":"admin@example.com", + "authored_date":"2018-11-08T15:55:26.000Z", + "committer_name":"Administrator", + "committer_email":"admin@example.com", + "committed_date":"2018-11-08T15:55:26.000Z" +} +``` + ## Get the diff of a commit Get the diff of a commit in a project. @@ -619,3 +660,4 @@ Example response: [ce-8047]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8047 [ce-15026]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15026 [ce-18004]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18004 +[ce-22919]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22919 |