capabilities.work

Count commits ahead and behind two refs

One step with GitLab. We can help you get access.

Look something up

Count commits ahead and behind two refs

with GitLab
Works with AI assistants

Use GitLab: its GitLab REST Repositories API lets you count commits ahead and behind two refs in a single step (GET /api/v4/projects/{id}/repository/diverging_commits). GitLab also has an MCP server, so an AI assistant like Claude or ChatGPT can do it for you. capabilities.work can help you get signed up and connected.

  • How far ahead or behind is one branch compared to another?
  • Can I cap how many commits are counted between two refs?
Say it to your AI assistant
  • Count commits diverging between {from} and {to} in project {id}.
  • Count at most {max_count} commits between {from} and {to} in {id}.
For your developer

GET /api/v4/projects/{id}/repository/diverging_commits in GitLab REST Repositories API. Full spec on APIs.io.