New action to commit changes via commits API
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=339634) </details> <!--IssueSummary end--> ### Description The [Commits API](https://docs.gitlab.com/ee/api/commits.html) provides an endpoint to commit changes ([POST /projects/:id/repository/commits](https://docs.gitlab.com/ee/api/commits.html#create-a-commit-with-multiple-files-and-actions)). This works fine. But if you, e.g., change only a small number of lines in a large file, then providing the whole file in the payload is not the best approach as the JSON object to commit the changes gets very big. A better approach to submit small changes in large files would be to submit only the diff. Using git directly this would be something like this: ``` # change files locally ... # create diff git diff --output=changes.patch # apply changes on remote side git apply changes.patch git commit -a -m "<commit message>" ``` For the remote part I would prefer a REST Api solution. ### Proposal Add new action `patch` to `POST /projects/:id/repository/commits`. The changes can be specified in standard git diff format using the `content` attribute of the endpoint. ### Possible usecase Patching files from a CI pipeline with some version-specific code.
issue