submodules

Update a submodule reference

Updates a reference for a specified submodule.

put/api/v4/projects/{id}/repository/submodules/{submodule}

Request

  • Base URL
    https://gitlab.com
  • Auth
    none declared

Path parameters

idstring required

The ID or URL-encoded path of a project

submodulestring required

URL-encoded full path to submodule.

Request body

commit_shastring required

Commit sha to update the submodule to.

branchstring required

Name of the branch to commit into.

commit_messagestring

Commit message. If no message is provided a default one will be set.

Example request

{
  "commit_sha": "ed899a2f4b50b4370feeea94676502b42383c746",
  "branch": "main",
  "commit_message": "Commit message"
}

Response

Update a submodule reference

idstring required
short_idstring required
created_atstring date-time required
parent_idsstring[] required
titlestring required
messagestring required
author_namestring required
author_emailstring required
authored_datestring date-time required
committer_namestring required
committer_emailstring required
committed_datestring date-time required
trailersobject required
extended_trailersobject required
web_urlstring required
statusstring required
project_idinteger required

Example response

{
  "id": "2695effb5807a22ff3d138d593fd856244e155e7",
  "short_id": "2695effb",
  "created_at": "2017-07-26T11:08:53.000+02:00",
  "parent_ids": [
    "2a4b78934375d7f53875269ffd4f45fd83a84ebe"
  ],
  "title": "Initial commit",
  "message": "Initial commit",
  "author_name": "John Smith",
  "author_email": "john@example.com",
  "authored_date": "2012-05-28T04:42:42-07:00",
  "committer_name": "Jack Smith",
  "committer_email": "jack@example.com",
  "committed_date": "2012-05-28T04:42:42-07:00",
  "trailers": {
    "Merged-By": "Jane Doe janedoe@gitlab.com"
  },
  "extended_trailers": {
    "Signed-off-by": [
      "John Doe <johndoe@gitlab.com>",
      "Jane Doe <janedoe@gitlab.com>"
    ]
  },
  "web_url": "https://gitlab.example.com/janedoe/gitlab-foss/-/commit/ed899a2f4b50b4370feeea94676502b42383c746",
  "stats": {
    "additions": 1,
    "total": 1
  },
  "status": "success",
  "project_id": 1,
  "last_pipeline": {
    "id": 1,
    "iid": 2,
    "project_id": 3,
    "sha": "0ec9e58fdfca6cdd6652c083c9edb53abc0bad52",
    "ref": "feature-branch",
    "status": "success",
    "source": "push",
    "created_at": "2022-10-21T16:49:48.000+02:00",
    "updated_at": "2022-10-21T16:49:48.000+02:00",
    "web_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/pipelines/61"
  }
}

Changes

No recorded changes to this operation across all 5 revisions of this API.