API: Ability to create a commit including multiple files #6833

Closed
opened 2025-11-02 07:07:56 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @d-lunyov on GitHub (Feb 9, 2021).

There are three endpoints to make a commit via API: repoUpdateFile, repoCreateFile, repoDeleteFile. But there are no way to make a commit, that contains a multiple changes in multiple files.

Originally created by @d-lunyov on GitHub (Feb 9, 2021). There are three endpoints to make a commit via API: [repoUpdateFile](https://try.gitea.io/api/swagger#/repository/repoUpdateFile), [repoCreateFile](https://try.gitea.io/api/swagger#/repository/repoCreateFile), [repoDeleteFile](https://try.gitea.io/api/swagger#/repository/repoDeleteFile). But there are no way to make a commit, that contains a multiple changes in multiple files.
GiteaMirror added the type/proposalmodifies/api labels 2025-11-02 07:07:56 -06:00
Author
Owner

@6543 commented on GitHub (Feb 9, 2021):

What about a endpoint, that apply diff & patch files?

cc @zeripath

@6543 commented on GitHub (Feb 9, 2021): What about a endpoint, that apply diff & patch files? cc @zeripath
Author
Owner

@zeripath commented on GitHub (Feb 9, 2021):

Heheh

Ok I'll simplify and propose the patch endpoint pr. We'll get the rest of stuff sorted later.

@zeripath commented on GitHub (Feb 9, 2021): Heheh Ok I'll simplify and propose the patch endpoint pr. We'll get the rest of stuff sorted later.
Author
Owner

@zeripath commented on GitHub (Feb 9, 2021):

@d-lunyov why aren't you creating a temporary working branch to commit stuff to and the merge it in to your primary branch?

@zeripath commented on GitHub (Feb 9, 2021): @d-lunyov why aren't you creating a temporary working branch to commit stuff to and the merge it in to your primary branch?
Author
Owner

@d-lunyov commented on GitHub (Feb 10, 2021):

@d-lunyov why aren't you creating a temporary working branch to commit stuff to and the merge it in to your primary branch?

@zeripath This is exactly what I do. But I think this is a workaround. In addition, the number of requests to the server increases in proportion to the number of files.

Another git-providers offers:
Github rest api commit steps:

  1. POST a new tree
  2. Create a new commit referred to the new tree SHA
  3. Patch a reference to set a new commit SHA

Gitlab: create a commit with multiple files and actions endpoint

Bitbucket: create new commits in the repository by uploading files

Azure: Push changes to the repository with multiple actions

Bitbucket-server also does not propose a simply-way to create a multiple files to commit, so I'm using a workaround with temporary branch.

@d-lunyov commented on GitHub (Feb 10, 2021): > @d-lunyov why aren't you creating a temporary working branch to commit stuff to and the merge it in to your primary branch? @zeripath This is exactly what I do. But I think this is a workaround. In addition, the number of requests to the server increases in proportion to the number of files. Another git-providers offers: **Github** rest api commit steps: 1) [POST a new tree](https://docs.github.com/en/rest/reference/git#create-a-tree) 2) [Create a new commit referred to the new tree SHA](https://docs.github.com/en/rest/reference/git#create-a-commit) 3) [Patch a reference to set a new commit SHA](https://docs.github.com/en/rest/reference/git#update-a-reference) **Gitlab**: [create a commit with multiple files and actions endpoint](https://docs.gitlab.com/ee/api/commits.html#create-a-commit-with-multiple-files-and-actions) **Bitbucket**: [create new commits in the repository by uploading files](https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/src#post) **Azure**: [Push changes to the repository with multiple actions](https://docs.microsoft.com/en-us/rest/api/azure/devops/git/pushes/create?view=azure-devops-rest-6.0) **Bitbucket-server** also does not propose a simply-way to create a multiple files to commit, so I'm using a workaround with temporary branch.
Author
Owner

@malarinv commented on GitHub (Mar 23, 2022):

Is there any progress on this issue? currently I'm blocked by this on a pr I'm working on to enable support for Gitea on https://github.com/fluxcd/go-git-providers . It is used by https://github.com/fluxcd/flux2 to support git resource reconciliation logic.
. see similar api usage from other providers at

@malarinv commented on GitHub (Mar 23, 2022): Is there any progress on this issue? currently I'm blocked by this on a pr I'm working on to enable support for Gitea on https://github.com/fluxcd/go-git-providers . It is used by https://github.com/fluxcd/flux2 to support git resource reconciliation logic. . see similar api usage from other providers at * https://github.com/fluxcd/go-git-providers/blob/main/github/client_repository_commit.go#L72 * https://github.com/fluxcd/go-git-providers/blob/main/gitlab/client_repository_commit.go#L67
Author
Owner

@lunny commented on GitHub (Mar 23, 2022):

I think we need both patch upload endpoint and multiple files changed endpoint.

@lunny commented on GitHub (Mar 23, 2022): I think we need both patch upload endpoint and multiple files changed endpoint.
Author
Owner

@denyskon commented on GitHub (Jan 31, 2023):

Are there any updates on that? I created a gitea backend for Static CMS, but without this feature I'm dependent on a hack which fails regularly....

@denyskon commented on GitHub (Jan 31, 2023): Are there any updates on that? I created a gitea backend for [Static CMS](https://github.com/StaticJSCMS/static-cms), but without this feature I'm dependent on a hack which fails regularly....
Author
Owner

@jimafisk commented on GitHub (Feb 17, 2023):

We're trying to implement Gitea as a backend for Plenti too, this unfortunately is a blocker for us. Per @d-lunyov's comment, the way GitLab uses actions works really well for our use-case.

@jimafisk commented on GitHub (Feb 17, 2023): We're trying to implement Gitea as a backend for [Plenti](https://plenti.co/) too, this unfortunately is a blocker for us. Per @d-lunyov's comment, the way GitLab uses actions works really well for our use-case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#6833