Skip to main content
The Gitea API provides endpoints for retrieving commit information, including individual commits, commit lists, and commit diffs.

Get Single Commit

Retrieve a single commit by its SHA or git reference.

Path Parameters

string
required
Owner of the repository
string
required
Name of the repository
string
required
A git reference or commit SHA

Query Parameters

boolean
default:"true"
Include diff stats for the commit (disable for speedup)
boolean
default:"true"
Include verification information for the commit (disable for speedup)
boolean
default:"true"
Include list of affected files (disable for speedup)

Response

string
Commit SHA hash
string
API URL for the commit
string
Web URL to view the commit
object
Commit information
object
Author information
string
Author name
string
Author email
string
Author date (ISO 8601)
object
Committer information (same structure as author)
string
Commit message
object
Tree information
string
Tree SHA
string
API URL for the tree
object
Commit signature verification
boolean
Whether the signature is verified
string
Verification status reason
array
Array of parent commit metadata
array
Array of affected files
string
Path of the affected file
string
File status: added, modified, deleted
object
Commit statistics
integer
Total lines changed
integer
Lines added
integer
Lines deleted

List All Commits

Get a list of all commits from a repository.

Path Parameters

string
required
Owner of the repository
string
required
Name of the repository

Query Parameters

string
SHA or branch to start listing commits from (usually ‘master’ or ‘main’)
string
Filepath of a file/directory to filter commits
string
Only commits after this date (ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ)
string
Only commits before this date (ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ)
boolean
default:"true"
Include diff stats for every commit
boolean
default:"true"
Include verification for every commit
boolean
default:"true"
Include list of affected files for every commit
string
Commits that match the given specifier will not be listed
integer
default:"1"
Page number of results (1-based)
integer
Page size of results (ignored if used with ‘path’)

Response

Returns an array of commit objects (same structure as Get Single Commit).
The response includes pagination headers:
  • X-Total-Count: Total number of commits
  • X-Page: Current page number
  • X-PerPage: Number of items per page
  • X-PageCount: Total number of pages
  • X-HasMore: Whether more pages exist

Download Commit Diff or Patch

Get a commit’s diff or patch file.

Path Parameters

string
required
Owner of the repository
string
required
Name of the repository
string
required
SHA of the commit to get
string
required
Output format: diff or patch

Response

Returns plain text diff or patch content.

Get Commit Pull Request

Retrieve the pull request that merged this commit.

Path Parameters

string
required
Owner of the repository
string
required
Name of the repository
string
required
SHA of the commit

Response

Returns a pull request object if the commit was part of a merged pull request.
integer
Pull request ID
integer
Pull request number
string
Pull request title
string
Pull request state: open, closed, merged
boolean
Whether the pull request was merged
string
Timestamp when merged (ISO 8601)
string
SHA of the merge commit

Common Use Cases

List Recent Commits

Get the most recent commits from the default branch:

Get Commits by Author

While the API doesn’t have a direct author filter, you can filter commits after fetching them or use the since parameter combined with knowing when the author was active.

Track File History

Get all commits that affected a specific file:

Verify Commit Signatures

Include verification information for all commits: