Skip to content
GitmoapAPIBeta
Schema

CompareResponse

Comparison between two branches: the divergence (ahead/behind), a bounded preview of the commits head adds over base, and the three-dot file diff.

Shape

  • aheadinteger · int320–∞Commits on head not on base.
  • base_shaCommitHash (string)Tip commit of the base (target) branch.
  • behindinteger · int320–∞Commits on base not on head.
  • commitsarray of CommitBounded, newest-first preview of the commits head adds over base.
    • The Commit schema
    • author_emailEmail (string)
    • author_namestring
    • authored_atstring
    • commit_shaCommitHash (string)
    • committed_atstring
    • committer_emailEmail (string)
    • committer_namestring
    • repository_idRepositoryId (string · uuid)
    • short_shaShortCommitHash (string)
    • titlestring
    • author_avatar_urlstring or nulloptional
    • committer_avatar_urlstring or nulloptional
    • messagestring or nulloptional
    • parent_shasarray of CommitHash (string)optional
    • tagsarray of TagName (string)optional
  • commits_truncatedbooleantrue when there are more commits than the preview cap returned.
  • diffDiffResponseThree-dot file diff. Note diff.base_sha is the merge base (or the base tip when histories are unrelated), not CompareResponse.base_sha.
    • The DiffResponse schema
    • base_shaCommitHash (string)
    • filesarray of DiffFile
      • The DiffFile schema
      • additionsinteger0–∞
      • collapsedbooleanThe patch was intentionally withheld (generated or oversized) to save bytes but is fetchable in full on demand via GET .../diff-file. Only ever set when patches were requested (include_patch=true).
      • deletionsinteger0–∞
      • generatedbooleanDetected generated/lock/minified file. Always computed from the path, independent of collapsed, so a client can badge or auto-fold it.
      • is_binaryboolean
      • patch_truncatedbooleanThe patch exceeds the hard per-file size cap and is omitted. Unlike collapsed, this file is not expandable in place — a client reads it piece-by-piece via GET .../file-lines instead.
      • pathstring
      • statusDiffFileStatusaddedmodifieddeletedrenamedcopied
      • collapse_reasonCollapseReasongeneratedlargeor nulloptionalWhy a file's patch body was withheld from a DiffFile (see collapsed). Distinct from patch_truncated, which marks a patch too large to ever send; a collapsed file's patch is fetchable on demand via GET .../diff-file.
      • old_pathstring or nulloptional
      • patchstring or nulloptional
    • has_morebooleanAnother page follows this one.
    • head_shaCommitHash (string)
    • pageinteger0–∞The page returned, from 0.
    • statsDiffStats
      • The DiffStats schema
      • additionsinteger0–∞Lines added across the whole change.
      • deletionsinteger0–∞Lines deleted across the whole change.
      • files_changedinteger0–∞Every file the change touches.
    • total_filesinteger0–∞How many files the pages can reach — every changed file, unless truncated.
    • truncatedbooleanThe change touches more files than any page can reach. stats still counts all of them.
  • head_shaCommitHash (string)Tip commit of the head (source) branch.
  • total_commitsinteger · int320–∞Total commits the comparison contains (== ahead, uncapped).
  • merge_base_shaCommitHash (string) or nulloptionalCommon ancestor of base and head. null when the two branches have unrelated histories (no common ancestor); the diff then degrades to a direct two-dot comparison against the base tip.

Example

Synthesized example
{
"ahead": 4,
"base_sha": "ab0a75d9b5b796ea2ce4da98d5ce442f4378ad7f",
"behind": 3,
"commits": [
{
"author_email": "tomas@acme.example",
"author_name": "Lin Park",
"authored_at": "2026-10-17T04:56:11Z",
"commit_sha": "bf29aa4bfbf7533d5e6c83e9cb26674ed5b92a65",
"committed_at": "2026-10-09T07:43:22Z",
"committer_email": "tomas@acme.example",
"committer_name": "payments-api",
"repository_id": "5b0e7c2a-9d14-4e8b-a6f1-2c3d4e5f6a70",
"short_sha": "dbeeba1937323de568eeaa5529a983ea9c725134",
"title": "Stream pipeline status into the run header"
},
{
"author_email": "lin@acme.example",
"author_name": "Lin Park",
"authored_at": "2026-10-09T07:26:50Z",
"commit_sha": "20a528f0a4c2a9994eae03d4f58bff9d248e05af",
"committed_at": "2026-10-13T16:07:51Z",
"committer_email": "tomas@acme.example",
"committer_name": "payments-api",
"repository_id": "5b0e7c2a-9d14-4e8b-a6f1-2c3d4e5f6a70",
"short_sha": "e837583f6e049c61e585a628adcdc7da323e2c8c",
"title": "Label every synthesized example"
}
],
"commits_truncated": false,
"diff": {
"base_sha": "2ef28392332b89ef63dff054d36dfa5d2673bbfe",
"files": [
{
"additions": 50,
"collapsed": false,
"deletions": 23,
"generated": false,
"is_binary": false,
"patch_truncated": false,
"path": "path-3417",
"status": "added"
},
{
"additions": 88,
"collapsed": false,
"deletions": 89,
"generated": false,
"is_binary": false,
"patch_truncated": false,
"path": "path-c1fe",
"status": "added"
}
],
"has_more": false,
"head_sha": "87d0d6205fa1090e852d55ee9d5b0d094f808074",
"page": 87,
"stats": {
"additions": 73,
"deletions": 0,
"files_changed": 42
},
"total_files": 6,
"truncated": false
},
"head_sha": "1890b69ef060366ef425fbadfce9350910fee337",
"total_commits": 5,
"merge_base_sha": "395b176e954ee4300c9f2d8eaff8dccd22a00af1"
}

Graph

Used inside

No schema contains this one.

Used by

Sent by 0 operations

No operation takes it as a request body.