Skip to content
Try Gitea Cloud ☁️ for 30 days → Accelerate your Development & Deploys!
This is the documentation of the next version, still under development. See the latest release.

Get commit comparison information

GET
/repos/{owner}/{repo}/compare/{basehead}
curl --request GET \
--url 'https://gitea.com/api/v1/repos/example/example/compare/example?output=diff' \
--header 'Authorization: Basic <credentials>'

By default returns JSON commit comparison information. The raw diff or patch can be requested with the output query parameter set to diff or patch respectively.

owner
required
string

Owner of the repo

repo
required
string

Name of the repo

basehead
required
string

Compare two refs as base...head (or base..head); refs may be branches, tags, full or short SHAs (including branch names that contain slashes), optionally with a ^ or ~N revision suffix.

output
string
Allowed values: diff patch

Return the raw comparison as diff or patch instead of JSON

Media typeapplication/json
Compare represents a comparison between two commits.
object
commits
Array<object>
Commit contains information generated from a Git commit.
object
author

User represents a user

object
active

Is user active

boolean
avatar_url

URL to the user’s avatar

string format: uri
created
string format: date-time
description

The user’s description

string
email
string format: email
followers_count

User counts

integer format: int64
following_count
integer format: int64
full_name

The user’s full name

string
html_url

URL to the user’s gitea page

string format: uri
id

The user’s id

integer format: int64
is_admin

Is the user an administrator

boolean
language

User locale

string
last_login
string format: date-time
location

The user’s location

string
login

Login of the user, same as username

string
login_name

Identifier of the user, provided by the external authenticator (if configured)

string
prohibit_login

Is user login prohibited

boolean
restricted

Is user restricted

boolean
source_id

The ID of the user’s Authentication Source

integer format: int64
starred_repos_count
integer format: int64
visibility

User visibility level option: public, limited, private

string
Allowed values: public limited private
website

The user’s website

string
commit
RepoCommit contains information of a commit in the context of a repository.
object
author
CommitUser contains information of a user in the context of a commit.
object
date

Date is the commit date in string format

string
email

Email is the person’s email address

string format: email
name

Name is the person’s name

string
committer
CommitUser contains information of a user in the context of a commit.
object
date

Date is the commit date in string format

string
email

Email is the person’s email address

string format: email
name

Name is the person’s name

string
message

Message is the commit message

string
tree
CommitMeta contains meta information of a commit in terms of API.
object
created

Created is the time when the commit was created

string format: date-time
sha

SHA is the commit SHA hash

string
url

URL is the API URL for the commit

string format: uri
url

URL is the API URL for the commit

string format: uri
verification

PayloadCommitVerification represents the GPG verification of a commit

object
payload

The signed payload content

string
reason

The reason for the verification status

string
signature

The GPG signature of the commit

string
signer

PayloadUser represents the author or committer of a commit

object
email
string format: email
name

Full name of the commit author

string
username

Username of the user

string
verified

Whether the commit signature is verified

boolean
committer

User represents a user

object
active

Is user active

boolean
avatar_url

URL to the user’s avatar

string format: uri
created
string format: date-time
description

The user’s description

string
email
string format: email
followers_count

User counts

integer format: int64
following_count
integer format: int64
full_name

The user’s full name

string
html_url

URL to the user’s gitea page

string format: uri
id

The user’s id

integer format: int64
is_admin

Is the user an administrator

boolean
language

User locale

string
last_login
string format: date-time
location

The user’s location

string
login

Login of the user, same as username

string
login_name

Identifier of the user, provided by the external authenticator (if configured)

string
prohibit_login

Is user login prohibited

boolean
restricted

Is user restricted

boolean
source_id

The ID of the user’s Authentication Source

integer format: int64
starred_repos_count
integer format: int64
visibility

User visibility level option: public, limited, private

string
Allowed values: public limited private
website

The user’s website

string
created

Created is the time when the commit was created

string format: date-time
files

Files contains information about files affected by the commit

Array<object>

CommitAffectedFiles store information about files affected by the commit

object
filename

Filename is the path of the affected file

string
status

Status indicates how the file was affected (added, modified, deleted)

string
html_url

HTMLURL is the web URL for viewing the commit

string format: uri
parents

Parents contains the parent commit information

Array<object>
CommitMeta contains meta information of a commit in terms of API.
object
created

Created is the time when the commit was created

string format: date-time
sha

SHA is the commit SHA hash

string
url

URL is the API URL for the commit

string format: uri
sha

SHA is the commit SHA hash

string
stats

CommitStats is statistics for a RepoCommit

object
additions

Additions is the number of lines added

integer format: int64
deletions

Deletions is the number of lines deleted

integer format: int64
total

Total is the total number of lines changed

integer format: int64
url

URL is the API URL for the commit

string format: uri
total_commits
integer format: int64
Example
{
"commits": [
{
"author": {
"visibility": "public"
},
"committer": {
"visibility": "public"
}
}
]
}

APIError is error format response

message
string
url
string

APINotFound is a not found empty response