// Get commit diff (shows changes from parent)
const commitDiff = await repo.getCommitDiff({
sha: "abc123def456...",
});
// Get commit diff compared to a specific base
const customDiff = await repo.getCommitDiff({
sha: "abc123def456...",
baseSha: "def789abc123...", // optional base commit to compare against
});
// Process file changes
commitDiff.files.forEach((file) => {
console.log(`${file.state}: ${file.path}`);
console.log(`Raw status: ${file.rawState}`);
});
// Filter to specific files
const filteredDiff = await repo.getCommitDiff({
sha: "abc123def456...",
paths: ["package.json", "src/main.ts"],
});