Git - Commit To Git

Commits the changes made in the workspace to the connected remote branch.

This API supports long running operations (LRO).

You can choose to commit all changes or only specific changed items. To sync the workspace for the first time, use this API after the Connect and Initialize Connection APIs.

Permissions

The caller must have a contributor or higher workspace role.

Required Delegated Scopes

Workspace.GitCommit.All.

Microsoft Entra supported identities

This API supports the Microsoft identities listed in this section.

Identity Support
User Yes
Service principal No
Managed identities No

Interface

POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/git/commitToGit

URI Parameters

Name In Required Type Description
workspaceId
path True

string

uuid

The workspace ID.

Request Body

Name Required Type Description
mode True

CommitMode

The mode for the commit operation.

comment

string

Caller-free comment for this commit. Maximum length is 300 characters. If no comment is provided by the caller, use the default Git provider comment.

items

ItemIdentifier[]

Specific items to commit. This is relevant only for Selective commit mode. The items can be retrieved from the Git Status API.

workspaceHead

string

Full SHA hash that the workspace is synced to. The hash can be retrieved from the Git Status API.

Responses

Name Type Description
200 OK

Request completed successfully.

202 Accepted

Request accepted, commit to Git in progress.

Headers

  • Location: string
  • x-ms-operation-id: string
  • Retry-After: integer
Other Status Codes

ErrorResponse

Common error codes:

  • WorkspaceNotConnectedToGit - Workspace is not connected to git.

  • WorkspaceHasNoCapacityAssigned - No capacity assinged to workspace.

  • WorkspaceHeadMismatch - Head in the request doesn't match the head in the system.

  • WorkspacePreviousOperationInProgress - Previous operation is still in progress.

  • InsufficientPrivileges - The caller does not have sufficient workspace permissions.

Examples

Commit all to Git example
Commit selective items to Git example

Commit all to Git example

Sample request

POST https://api.fabric.microsoft.com/v1/workspaces/1565e6a3-c020-4c0c-dda7-92bafe99eec5/git/commitToGit

{
  "mode": "All",
  "workspaceHead": "eaa737b48cda41b37ffefac772ea48f6fed3eac4",
  "comment": "I'm committing all my changes."
}

Sample response

Location: https://api.fabric.microsoft.com/v1/operations/431e8d7b-4a95-4c02-8ccd-6faef5ba1bd7
x-ms-operation-id: 431e8d7b-4a95-4c02-8ccd-6faef5ba1bd7
Retry-After: 30

Commit selective items to Git example

Sample request

POST https://api.fabric.microsoft.com/v1/workspaces/1565e6a3-c020-4c0c-dda7-92bafe99eec5/git/commitToGit

{
  "mode": "Selective",
  "workspaceHead": "eaa737b48cda41b37ffefac772ea48f6fed3eac4",
  "comment": "I'm committing specific changes.",
  "items": [
    {
      "logicalId": "111e8d7b-4a95-4c02-8ccd-6faef5ba1bd1",
      "objectId": "1153f3b4-dbb8-33c1-a84f-6ae4d776362d"
    },
    {
      "objectId": "7753f3b4-dbb8-44c1-a94f-6ae4d776369e"
    }
  ]
}

Sample response

Location: https://api.fabric.microsoft.com/v1/operations/431e8d7b-4a95-4c02-8ccd-6faef5ba1bd7
x-ms-operation-id: 431e8d7b-4a95-4c02-8ccd-6faef5ba1bd7
Retry-After: 30

Definitions

Name Description
CommitMode

Modes for the commit operation. Additional modes may be added over time.

CommitToGitRequest

Contains the commit request.

ErrorRelatedResource

The error related resource details object.

ErrorResponse

The error response.

ErrorResponseDetails

The error response details.

ItemIdentifier

Contains the item identifier. At least one of the properties must be defined.

CommitMode

Modes for the commit operation. Additional modes may be added over time.

Name Type Description
All

string

Commit all uncommitted changes. The caller is not required to provide the list of items to commit.

Selective

string

Commit a specified items list that has uncommitted changes.

CommitToGitRequest

Contains the commit request.

Name Type Description
comment

string

Caller-free comment for this commit. Maximum length is 300 characters. If no comment is provided by the caller, use the default Git provider comment.

items

ItemIdentifier[]

Specific items to commit. This is relevant only for Selective commit mode. The items can be retrieved from the Git Status API.

mode

CommitMode

The mode for the commit operation.

workspaceHead

string

Full SHA hash that the workspace is synced to. The hash can be retrieved from the Git Status API.

ErrorRelatedResource

The error related resource details object.

Name Type Description
resourceId

string

The resource ID that's involved in the error.

resourceType

string

The type of the resource that's involved in the error.

ErrorResponse

The error response.

Name Type Description
errorCode

string

A specific identifier that provides information about an error condition, allowing for standardized communication between our service and its users.

message

string

A human readable representation of the error.

moreDetails

ErrorResponseDetails[]

List of additional error details.

relatedResource

ErrorRelatedResource

The error related resource details.

requestId

string

ID of the request associated with the error.

ErrorResponseDetails

The error response details.

Name Type Description
errorCode

string

A specific identifier that provides information about an error condition, allowing for standardized communication between our service and its users.

message

string

A human readable representation of the error.

relatedResource

ErrorRelatedResource

The error related resource details.

ItemIdentifier

Contains the item identifier. At least one of the properties must be defined.

Name Type Description
logicalId

string

The logical ID of the item. When the logical ID isn't available because the item is not yet added to the workspace, you can use the object ID.

objectId

string

The object ID of the item. When the object ID isn't available because the item was deleted from the workspace, you can use the logical ID.