Skip to main content

Git Diff Review

Git diff mode packages changes between two refs so you can review patches without manually copying diffs and related files.

Base and head

Think of a diff as:

base...head
  • Base is the starting point you compare against.
  • Head is the branch, commit, or working state you want to review.

Examples:

main...HEAD
audit-base...sponsor-fix

Use main...HEAD for local PR-style review. Use audit-base...sponsor-fix when checking a remediation branch against the version you originally reviewed.

PR review workflow

  1. Open the Git repository.
  2. Set base to the target branch, such as main.
  3. Set head to the PR branch or HEAD.
  4. Review the changed file list.
  5. Start with diff-only context.
  6. Add full files for changed modules that need surrounding code.
  7. Apply a PR review template.
  8. Run the secret scanner.
  9. Copy or export the bundle.
  1. Set base to the audit baseline or finding commit.
  2. Set head to the sponsor fix branch.
  3. Include the original issue summary in user instructions if it is safe to share.
  4. Include changed files, related dependencies, and regression tests.
  5. Ask whether the patch fixes the root cause and introduces new issues.

See Sponsor fix review for the full remediation workflow.

Diff-only vs diff plus full files

Use diff-only when:

  • The PR is small.
  • You are checking a narrow sponsor fix.
  • The changed lines contain enough surrounding context.
  • You already understand the module.

Use diff plus full files when:

  • The changed code depends on modifiers, inheritance, libraries, or helper functions.
  • The diff changes state transitions or accounting.
  • The patch changes external calls, authorization, or initialization.
  • Tests need full context to explain expected behavior.
Start narrow

Start with diff-only, then add full files when the review question needs more context. This keeps token usage easier to reason about.

Limitations

Git diff mode depends on local Git state. It can be blocked or misleading when:

  • The selected folder is not a Git repository.
  • Base or head refs do not exist locally.
  • A shallow clone does not include the base commit.
  • The working tree has uncommitted changes you did not intend to include.
  • Submodules or nested repositories hold relevant code outside the selected repo.
  • Large renames or generated files obscure the meaningful change.

When in doubt, run git status and git diff base...head locally to confirm what PastePrompt should package.