The Traditional Pain
Reviewing a PR without worktrees:- Stash your current work:
git stash - Fetch PR branch:
git fetch origin pull/123/head:pr-123 - Checkout PR:
git checkout pr-123 - Install dependencies:
npm install - Test the changes
- Return to your work:
git checkout your-branch - Unstash:
git stash pop - Reinstall dependencies:
npm install
Worktree Review Flow
1
Create review worktree
While working on your feature, create a worktree for the PR:The
-x flag prevents opening an editor, keeping your current editor focused on your work.2
Fetch and checkout the PR
3
Review in isolation
Test the PR without affecting your work:Your original work in
repo-feature-login/ is completely untouched.4
Leave feedback
Add review comments using GitHub CLI:Or request changes:
5
Clean up
After reviewing, remove the worktree:Your original work remains untouched. Return to it instantly:
Multiple PR Reviews
Review multiple PRs simultaneously:Review Scenarios
Quick Approval
For simple PRs that just need a quick look:
Deep Review
For complex PRs requiring thorough testing:
Review + Test Changes
Test PR with your feature:
Suggest Changes
Make suggested edits directly:
GitHub CLI Integration
Powerful PR review commands withgh:
List PRs needing review
Check out PR directly
View PR details
Review with comments
Add inline comments
Advanced Review Workflows
Compare with main
Compare with main
Review changes side-by-side:Or use a GUI:
Run performance tests
Run performance tests
Benchmark PR against main:
Security review
Security review
Check for security issues:
Visual regression testing
Visual regression testing
Compare UI changes:
Team Review Practices
Assign yourself as reviewer
Create worktree immediately when assigned:Batch review sessions
Set up all PRs for your review session:Leave detailed feedback
Quick Commands Reference
Best Practices
Review in fresh worktrees - Always create a new worktree for PR reviews to ensure a clean environment.
Troubleshooting
PR checkout fails
PR checkout fails
If
gh pr checkout fails:Dependency conflicts
Dependency conflicts
If dependencies conflict with your main work:Each worktree has independent
node_modules.Port conflicts when testing
Port conflicts when testing
Run PR dev server on different port:
Next Steps
Parallel Agents
Run multiple AI agents simultaneously on different branches.
Feature Development
Learn the complete feature development workflow.