---
title: "GET /api/v4/projects/{id}/repository/diverging_commits"
method: GET
path: "/api/v4/projects/{id}/repository/diverging_commits"
tags: ["repositories"]
---

# GET /api/v4/projects/{id}/repository/diverging_commits

`GET /api/v4/projects/{id}/repository/diverging_commits`

## Request

- Base URL: `https://gitlab.com`
- URL: `https://gitlab.com/api/v4/projects/{id}/repository/diverging_commits`
- Auth: none declared

Retrieve diverging commit counts between two refs

## Path parameters

- `id` string, required

## Query parameters

- `from` string, required
- `to` string, required
- `max_count` integer

## Response `200`

Retrieve diverging commit counts between two refs

- APIEntitiesDivergingCommitCount: API_Entities_DivergingCommitCount model
  - `behind` integer, required
  - `ahead` integer, required

## Other responses

- `400`: Bad request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not found
- `429`: Too many requests

---

[API](https://skmtc.dev/gitlab/apis/gitlab-api.md) - [All operations](https://skmtc.dev/gitlab/apis/gitlab-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gitlab/apis/gitlab-api/revisions/b234947ef3f2?raw)
