Commit a File via a Git Push
A 3-step recipe with Azure DevOps. We can help you get access.
Recipe · 3 steps
Commit a File via a Git Push
with Azure DevOps · Software Construction Management
Resolve a branch tip, push a file change, and confirm the push.
- List refs filtered to the target branch to resolve its current object ID, which becomes the oldObjectId of the push refUpdate.
- Create a push that advances the branch from the resolved tip and commits a single file edit with raw text content.
- List recent pushes on the branch to confirm the new push is present.
What you'll need to have ready
- apiVersion: Azure DevOps REST API version (e.g. 7.1).
- repositoryId: Repository ID or name to commit into.
- branchRef: Full branch ref to update (e.g. refs/heads/main).
- filePath: Path of the file to add or edit (e.g. /docs/readme.md).
- fileContent: Raw text content to write to the file.
- commitMessage: Commit message for the push.
- accessToken: Azure DevOps bearer (OAuth 2.0) access token.
For your developer
Arazzo workflow microsoft-azure-devops:commit-file-via-push, 3 operations: refs_list → pushes_create → pushes_list. Specs on APIs.io.