comparison-base

Resolves the correct Git comparison base commit for branch reviews and change analysis.

4.9k|585|Updated Aug 22, 2019
One-click install
npx skills add https://github.com/microsoft/FluidFramework --skill comparison-base
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: comparison-base
Source: https://github.com/microsoft/FluidFramework/tree/main/.claude/skills/comparison-base
Command: npx skills add https://github.com/microsoft/FluidFramework --skill comparison-base

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Code reviews and change analysis often diff against the wrong base, especially in fork checkouts, squash-merge workflows, or shallow clones, producing misleading diffs. This Skill deterministically resolves the PR target branch or the canonical microsoft/FluidFramework upstream, selects the correct merge-base commit, and detects substantial divergence before any diff is read.

Core Features & Use Cases

  • PR Target Resolution: Locates the open pull request for a review branch via editor PR metadata, branch queries, or the GitHub commit-to-PR API, with fork-safe explicit repository handling.
  • Merge-Base Selection: Computes all best common ancestors with git merge-base --all, handles shallow repositories by deepening history, and asks the user when multiple ancestors exist.
  • Divergence Detection: Counts commits on both sides of the base and warns when either side exceeds 50 commits, offering options such as merging the target branch first.
  • Use Case: A reviewer checks out a contributor's branch in the FluidFramework repo and needs the exact commit to diff against; this Skill fetches the target branch into a dedicated ref and returns a verified $BASE_COMMIT for the caller's review workflow.

Quick Start

Ask the AI to resolve the comparison base for the current branch review, optionally passing a review ref such as a branch name or commit.

Frequently Asked Questions about comparison-base

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find the right base commit for a Git branch review?

Use git merge-base --all between the target branch ref and the review ref to find all best common ancestors. This Skill automates that by resolving the PR target branch, fetching it into a dedicated ref, and verifying the base commit is an ancestor of both sides.

How to diff a branch against its pull request target on GitHub?

First resolve the open PR for the branch using gh pr list with an explicit --repo flag, then fetch the base branch and compute the merge-base. Diffing directly against the PR base branch tip can include unrelated changes, so the shared ancestor commit is the correct comparison point.

Why does git merge-base return nothing in a shallow clone?

Shallow repositories truncate history, so the common ancestor may be missing. Deepen both the target and review histories from their fetch sources and retry; only treat the histories as unrelated after the repository is confirmed complete.

What happens when a branch has diverged far from the target branch?

When either side has more than 50 commits since the comparison commit, the Skill stops and reports divergence details including commit counts, tip dates, and elapsed time. It asks whether to continue, pick another target, or merge the target branch first with explicit approval.

Can this handle fork checkouts with multiple remotes?

Yes, it resolves the branch's push remote, remote.pushDefault, or configured upstream to identify the published repository, and always passes explicit --repo owner/repository to GitHub CLI commands. If multiple remotes match a branch, it asks the user which one to use.