A simpler API for authoring commits
The new GraphQL mutationcreateCommitOnBranch
makes it easier to add, update, and delete files in a branch of a repository.
This new API offers a simpler way to commit changes compared to the existingGit database REST APIs. With the newcreateCommitOnBranch
mutation, you do not need to manually create blobs and trees before creating the commit. This allows you to add, update, or delete multiple files in a single API call.
Commits authored using the new API are automatically GPG signed and aremarked as verified in the GitHub UI. GitHub Apps can use the mutation to author commits directly oron behalf of users.
See theGraphQL API reference for more information on usingcreateCommitOnBranch
. You can also try it in theGraphQL API Explorer! If you need a refresher on how to use the GraphQL API, see ourguide.
Subscribe to our developer newsletter
Discover tips, technical guides, and best practices in our biweekly newsletter just for devs.