gitlab_compare_refs
Compare two Git references to review changes between branches, tags, or commits before merging. Shows commits and diffs to understand what changed between two points in a GitLab project.
Instructions
Compare two git references Returns: Commits and diffs between refs Use when: Reviewing changes before merge Shows: What changed between two points
Example: Compare feature branch to main
from: "main"
to: "feature/new-feature" Shows all changes in feature branch
Related tools:
gitlab_create_merge_request: Create MR from comparison
gitlab_smart_diff: Advanced diff options
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No | Project identifier (auto-detected if not provided) Type: integer OR string Format: numeric ID or 'namespace/project' Optional: Yes - auto-detects from current git repository Examples: - 12345 (numeric ID) - 'gitlab-org/gitlab' (namespace/project path) - 'my-group/my-subgroup/my-project' (nested groups) Note: If in a git repo with GitLab remote, this can be omitted | |
| from_ref | Yes | Source reference for comparison Type: string Required: Yes Format: Branch, tag, or commit SHA Examples: - 'feature/new-api' (branch) - 'v1.0.0' (tag) - 'abc123def' (commit) Use case: Starting point for comparison | |
| to_ref | Yes | Target reference for comparison Type: string Required: Yes Format: Branch, tag, or commit SHA Examples: - 'main' (branch) - 'v2.0.0' (tag) - '456789abc' (commit) Use case: Ending point for comparison | |
| straight | No | Diff type Type: boolean Default: false Options: - true: Direct comparison (A..B) - false: Three-dot comparison (A...B) Explanation: - Direct: All changes between two points - Three-dot: Changes in B since common ancestor Use case: false for MR-style diffs, true for direct comparison |