PushChanges
Pushes changes to a repository in your Azure DevOps instance.
Stored Procedure Specific Information
Pushing Changes
Pushing to Azure DevOps repositories through the REST API requires highly specific configurations. For this reason, the ChangesAggregate input must be provided as JSON.
This can be achieved through temporary tables:
INSERT INTO ChangesAggregate#temp ([changeType], [item.path], [newContent.contentPath], [newContent.contentType]) VALUES ('add', '/images/people/files.jpg', 'C:/path/to/file.jpg', 'base64encoded') EXEC PushChanges @BranchRefName='refs/heads/main', @OldObjectId='503b549b6dd4b0c4692fce1b726bfa03bebb6ffb', @CommitComment='Test Comment', @ChangesAggregate='ChangesAggregate#temp', @RepositoryId='28478171-fc07-468e'
Or by providing the JSON body of the object-array directly:
EXEC PushChanges @BranchRefName='refs/heads/main', @OldObjectId='503b549b6dd4b0c4692fce1b726bfa03bebb6ffb', @CommitComment='Test Comment', @ChangesAggregate='[{"changetype": "add","newcontent": {"contenttype": "base64encoded","contentpath": "C:/test.jpg"},"item": {"path": "/images/test.jpg"}}]', @RepositoryId='28478171-fc07-468e-8a53-4a9553fde744'For more information on the available change types, see the "Pushes - Create" chapter of the Azure DevOps REST API documentation.
Input
Name | Type | Required | Description |
ProjectId | String | False | Id or name of project. |
RepositoryId | String | True | Id or name of repository. Must be set to repository id if ProjectId not set. |
BranchRefName | String | True | Fully resolved name of git branch. |
OldObjectId | String | True | Current Object ID of branch. |
CommitComment | String | True | Comment to be sent with commit. |
ChangesAggregate | String | True | Aggregate object which holds details of each change being made in the commit. |
Result Set Columns
Name | Type | Description |
NewObjectId | String | Object Id of repository after commit has completed. |
CommitId | String | Id of generated Commit. |
CommitTreeId | String | Id of commit tree for generated commit. |
AuthorName | String | Name of file author. |
AuthorEmail | String | Email address of file author. |
AuthoredDate | Datetime | Creation date of affected file. |
CommitterName | String | Name of commit author. |
CommitterEmail | String | Email address of commit author. |
CommittedDate | Datetime | Date of commit creation. |
CommitUrl | String | URL of generated commit object. |
RepositoryId | String | Id of affected repository. |
RepositoryName | String | Name of affected repository. |
PushId | String | Id of push to repository. |
PushDate | String | Date of push to repository. |
PushURL | String | URL of push to repository. |