Skip to content

Commits Extensions

Forgejo’s built-in commit API does not support full-text search. The proxy adds a search endpoint that queries commit messages, author names, and SHAs.

MethodEndpointDescription
GET/api/v1/repos/{owner}/{repo}/git/commits/searchSearch commits in a repository
GET/api/v1/repos/{owner}/{repo}/commits/latestGet the latest commit on a branch
ParameterDescription
ownerRepository owner (user or organisation name)
repoRepository name
ParameterTypeDefaultDescription
qstring(required)Search term — matched against commit messages, author names, and SHAs
pageinteger1Page number for pagination
limitinteger20Number of results per page
ParameterTypeDefaultDescription
branchstringdefault branchBranch name to fetch the latest commit from
Terminal window
# Search for commits mentioning "fix authentication"
curl -H 'Authorization: token $TOKEN' \
'https://forgejo-proxy.hochguertel.work/api/v1/repos/myorg/myrepo/git/commits/search?q=fix+authentication'
# Search by author name, page 2
curl -H 'Authorization: token $TOKEN' \
'https://forgejo-proxy.hochguertel.work/api/v1/repos/myorg/myrepo/git/commits/search?q=tobias&page=2&limit=10'
# Search by partial SHA
curl -H 'Authorization: token $TOKEN' \
'https://forgejo-proxy.hochguertel.work/api/v1/repos/myorg/myrepo/git/commits/search?q=a3f9c2'
# Get the latest commit on the default branch
curl -H 'Authorization: token $TOKEN' \
'https://forgejo-proxy.hochguertel.work/api/v1/repos/myorg/myrepo/commits/latest'
# Get the latest commit on a specific branch
curl -H 'Authorization: token $TOKEN' \
'https://forgejo-proxy.hochguertel.work/api/v1/repos/myorg/myrepo/commits/latest?branch=develop'

Returns an array of commit objects compatible with Forgejo’s commit schema:

[
{
"sha": "a3f9c2d1e4b5...",
"commit": {
"message": "fix: correct authentication token handling",
"author": {
"name": "Tobias Hochgürtel",
"email": "tobias@example.com",
"date": "2024-11-01T10:30:00Z"
}
},
"html_url": "https://forgejo.example.com/myorg/myrepo/commit/a3f9c2d1e4b5..."
}
]

Returns a single commit object:

{
"sha": "b7e1a3f9c2d1...",
"commit": {
"message": "chore: bump version to 1.4.2",
"author": {
"name": "Tobias Hochgürtel",
"email": "tobias@example.com",
"date": "2024-12-01T08:00:00Z"
}
},
"html_url": "https://forgejo.example.com/myorg/myrepo/commit/b7e1a3f9c2d1..."
}