github / github/github-mcp-server

Add compare_commits tool for branch/commit diff analysis

Đang mở
#1,910 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
33k
Fork
5k
Merge trung bình
2 ngày 1 giờ
Pull request đã merge (30 ngày)
52

Mô tả

### Describe the feature or problem you'd like to solve

There's no way to compare two branches or commits to see what changed between them. Agents can fetch individual commits but can't answer "what's different between `main` and `feature-x`?" without manually iterating through commit history.

I ran into this when trying to generate release notes. My agent needed to see the diff between `v1.0.0` and `v1.1.0` but had to fall back to listing every commit, then filtering — slow and error-prone.

### Proposed solution

Add a `compare_commits` tool wrapping:

```
GET /repos/{owner}/{repo}/compare/{basehead}
```

Where `basehead` is `base...head` (e.g., `main...feature-branch` or `v1.0.0...v1.1.0`).

Returns:
- Commits between the two refs
- Files changed with diff stats
- Ahead/behind counts

### Example prompts or workflows

1. "What commits are in `develop` that aren't in `main` yet?"
2. "Show me the files changed between v1.0.0 and v1.1.0"
3. "How many commits ahead is this feature branch?"
4. "Generate release notes by comparing the last two tags"
5. "Check if staging is up to date with production"

### Additional context

This is a single REST endpoint with high utility — it's foundational for release automation, PR analysis, and branch management. Happy to submit a PR if this feature is accepted.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.