Use this API to update Git submodules.

Update a submodule reference

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

Updates a reference for a specified submodule.

Parameters

NameTypeDescription
id
Path, required
StringID or URL-encoded path of the project
Example: gitlab-org/gitlab
submodule
Path, required
StringURL-encoded full path to the submodule, for example lib%2Fclass%2Erb
Example: gitlab-org/gitlab-shell

Request body (application/json)

PropertyTypeDescription
branch
Required
StringName of the branch to commit into
Example: main
commit_messageStringCommit message. If omitted, a default message is used
Example: Commit message
commit_sha
Required
StringFull commit SHA to update the submodule to
Example: ed899a2f4b50b4370feeea94676502b42383c746

Responses

CodeDescriptionSchema
200OKAPIEntitiesCommitDetail
400The repository is empty—
401401 Unauthorized—
404404 Project Not Found—

Schemas

Objects returned by the operations above and objects nested in their request bodies.

APIEntitiesCommitDetail

PropertyTypeDescription
author_emailStringExample: john@example.com
author_nameStringExample: John Smith
authored_dateString (date-time)Example: 2012-05-28T04:42:42-07:00
committed_dateString (date-time)Example: 2012-05-28T04:42:42-07:00
committer_emailStringExample: jack@example.com
committer_nameStringExample: Jack Smith
created_atString (date-time)Example: 2017-07-26T11:08:53.000+02:00
extended_trailersObjectExample: {"Signed-off-by":["John Doe \u003cjohndoe@gitlab.com\u003e","Jane Doe \u003cjanedoe@gitlab.com\u003e"]}
idStringExample: 2695effb5807a22ff3d138d593fd856244e155e7
last_pipelineObject—
messageStringExample: Initial commit
parent_idsArray of stringsExample: ["2a4b78934375d7f53875269ffd4f45fd83a84ebe"]
project_idInteger (int64)Example: 1
short_idStringExample: 2695effb
statsAPIEntitiesCommitStats—
statusStringExample: success
titleStringExample: Initial commit
trailersObjectExample: {"Merged-By":"Jane Doe janedoe@gitlab.com"}
web_urlStringExample: https://gitlab.example.com/janedoe/gitlab-foss/-/commit/ed899a2f4b50b4370feeea94676502b42383c746

APIEntitiesCommitStats

PropertyTypeDescription
additionsIntegerExample: 1
deletionsIntegerExample: 0
totalIntegerExample: 1