Skip to content

Instantly share code, notes, and snippets.

@ricab
Last active October 2, 2026 22:15
Show Gist options
  • Select an option

  • Save ricab/b69a8845a7d46b92e851b24518e837cf to your computer and use it in GitHub Desktop.

Select an option

Save ricab/b69a8845a7d46b92e851b24518e837cf to your computer and use it in GitHub Desktop.
See what changed in a PR since your last review

See what changed in a PR since your last review

Useful when the author force-pushed (rebased/amended) after your review, so no branch points to the commit you reviewed anymore.

Use

gh pr checkout 1234   # or update your existing checkout of the PR
gh since-review

Setup (once)

# Alias to find the SHA at your latest review.
# Takes an optional PR number; defaults to the PR of the current branch.
gh alias set last-review-commit --shell \
  'pr=${1:-$(gh pr view --json number --jq .number)} || exit
   gh api "repos/{owner}/{repo}/pulls/$pr/reviews" --paginate \
     --jq ".[] | select(.user.login==\"$(gh api user --jq .login)\") | .commit_id" | tail -n1'

# Get changes since the last review
gh alias set since-review --clobber --shell \
  'base=$(gh pr view --json baseRefName --jq .baseRefName) &&
   old=$(gh last-review-commit) &&
   git fetch origin "$base" "$old" &&
   git range-diff "origin/$base" "$old" HEAD'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment