Skip to main content
// Compare feature branch to main
const diff = await repo.getBranchDiff({
  branch: "feature/new-auth",
  base: "main", // optional, defaults to default branch
});

console.log(`Changed files: ${diff.stats.files}`);
console.log(`+${diff.stats.additions} -${diff.stats.deletions}`);

// Filter to specific files
const filteredDiff = await repo.getBranchDiff({
  branch: "feature/new-auth",
  paths: ["src/auth.ts", "src/utils/token.ts"],
});

Options

ParameterTypeDescription
branchRequiredThe branch name to get the diff for
baseOptionalBase branch to compare against (defaults to repository’s default branch)
ephemeralOptionalWhen true, resolves the branch under the ephemeral namespace
ephemeralBase (TypeScript)
ephemeral_base (Python)
OptionalWhen true, resolves the base branch under the ephemeral namespace
pathsOptionalArray of file paths to filter the diff. When provided, only returns diffs for the specified files and bypasses size/type filtering

Response

FieldTypeDescription
statsObjectSummary with files, additions, and deletions
filesArrayList of changed files with their diffs