Skip to content

Update a submodule reference

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

Updates a reference for a specified submodule.

id
required
string

The ID or URL-encoded path of a project

Example
gitlab-org/gitlab
submodule
required
string

URL-encoded full path to submodule.

Example
gitlab-org/gitlab-shell
Media type application/json
object
commit_sha
required

Commit sha to update the submodule to.

string
nullable
Example
ed899a2f4b50b4370feeea94676502b42383c746
branch
required

Name of the branch to commit into.

string
nullable
Example
main
commit_message

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

string
nullable
Example
Commit message

OK

Media type application/json
object
id
string
short_id
string
created_at
string format: date-time
parent_ids
Array<string>
title
string
message
string
author_name
string
author_email
string
authored_date
string format: date-time
committer_name
string
committer_email
string
committed_date
string format: date-time
trailers
object
extended_trailers
object
web_url
string
stats
object
additions
integer
deletions
integer
total
integer
status
string
project_id
integer format: int64
last_pipeline
object
Example
{
"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,
"deletions": 0,
"total": 1
},
"status": "success",
"project_id": 1
}

The repository is empty

401 Unauthorized

404 Project Not Found