Reviewing Pull Requests as Uncommitted Changes
The hardest part of code review for me is seeing how the changes fit together. The GitHub UI shows a diff, file by file, and I lose the bigger picture.
I want to review a PR as if it were uncommitted changes in my own editor, so I can use the LSP to go to definitions, find references, and check types. I can also point a coding agent at the changes in read-only mode and ask questions about them.
Git makes this quite simple: check out the PR, then use git reset without --hard to reset to the merge base, leaving the code in place and the changes uncommitted.
I do this in a separate worktree so it doesn’t interfere with whatever I’m working on. Since I use Worktrunk to manage worktrees, I added a few aliases to its config:
| |
The review-pr alias creates a worktree from the PR and resets it to the merge base, so I only see the PR’s changes, even if more commits have landed on the base branch since.
For a single commit, review resets to its parent (HEAD~1), while the -done aliases remove the worktree and its branch when I’m finished.
Now I can use:
| |
I just open the worktree in my editor and review the changes with the same tools I use when writing the code.