Skip to main content

Get commits

Retrieve a list of commits from a repository.
GET /api/commits

Parameters

owner
string
required
The username or organization name that owns the repository
repo
string
required
The repository name
ref
string
The branch, tag, or commit reference to retrieve commits from. Defaults to the default branch if not specified
limit
number
Maximum number of commits to return (depth). If not specified, returns all commits

Response

Returns an array of commit objects.
oid
string
The commit object ID (SHA-1 hash)
message
string
The commit message
author
object
Information about the commit author
name
string
Author’s name
email
string
Author’s email address
timestamp
number
Unix timestamp when the commit was authored
committer
object
Information about the committer
name
string
Committer’s name
email
string
Committer’s email address
timestamp
number
Unix timestamp when the commit was committed
parent
string[]
Array of parent commit OIDs

Example request

curl -X GET "https://api.gitflare.dev/api/commits?owner=johndoe&repo=my-project&ref=main&limit=10"

Example response

[
  {
    "oid": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0",
    "message": "Add user authentication feature",
    "author": {
      "name": "John Doe",
      "email": "[email protected]",
      "timestamp": 1709568000
    },
    "committer": {
      "name": "John Doe",
      "email": "[email protected]",
      "timestamp": 1709568000
    },
    "parent": ["b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1"]
  },
  {
    "oid": "b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1",
    "message": "Initial commit",
    "author": {
      "name": "John Doe",
      "email": "[email protected]",
      "timestamp": 1709481600
    },
    "committer": {
      "name": "John Doe",
      "email": "[email protected]",
      "timestamp": 1709481600
    },
    "parent": []
  }
]

Get commit details

Retrieve detailed information about a specific commit, including the files changed.
GET /api/commit

Parameters

owner
string
required
The username or organization name that owns the repository
repo
string
required
The repository name
commitOid
string
required
The commit object ID (SHA-1 hash) to retrieve details for

Response

Returns an object containing commit details and file changes.
commit
object
The commit object
oid
string
The commit object ID (SHA-1 hash)
message
string
The commit message
author
object
Information about the commit author
committer
object
Information about the committer
parent
string[]
Array of parent commit OIDs
changes
array
Array of file changes in the commit
path
string
File path relative to repository root
type
string
Type of change: add, modify, or delete
oldOid
string
Previous blob OID (for modifications and deletions)
newOid
string
New blob OID (for additions and modifications)

Example request

curl -X GET "https://api.gitflare.dev/api/commit?owner=johndoe&repo=my-project&commitOid=a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0"

Example response

{
  "commit": {
    "oid": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0",
    "message": "Add user authentication feature",
    "author": {
      "name": "John Doe",
      "email": "[email protected]",
      "timestamp": 1709568000
    },
    "committer": {
      "name": "John Doe",
      "email": "[email protected]",
      "timestamp": 1709568000
    },
    "parent": ["b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1"]
  },
  "changes": [
    {
      "path": "src/auth/login.ts",
      "type": "add",
      "newOid": "c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2"
    },
    {
      "path": "src/utils/helpers.ts",
      "type": "modify",
      "oldOid": "d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3",
      "newOid": "e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4"
    },
    {
      "path": "src/old-auth.ts",
      "type": "delete",
      "oldOid": "f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x4y5"
    }
  ]
}

Build docs developers (and LLMs) love