Guide

Review a pull request with Claude Code without touching your own code

Published · Updated

A dark Windows PowerShell window showing claude -w with a quoted pull request number

Short answerRun claude -w "#123" to fetch pull request 123 into a separate git worktree and start Claude Code there, so your own files stay exactly as they are. Keep the quotes, or the shell treats the hash as a comment.

A teammate sends a pull request while you are halfway through your own work. You do not have to stash anything.

Open the pull request in its own copy

PowerShell
claude -w "#123"

That makes a separate copy of the project (a git worktree) just for that pull request, in its own folder. Your own files stay exactly as they are. Then ask Claude to review it, run the tests, or try the change, all in that copy.

Keep the quotes

In most shells a # starts a comment, so without the quotes the number is thrown away.

No pull request yet?

Give a name instead and you get a fresh copy to experiment in:

PowerShell
claude -w feature-auth

Other forms

It also accepts the full link to a GitHub pull request, and GitLab merge requests work too. It fetches from your origin remote.

Where the copy lives

Inside your project, in .claude/worktrees/. Remove it when you are done, and check that .claude/worktrees is ignored by git.

A review routine

  1. Open the pull request in its own copy with claude -w "#123".
  2. Ask Claude to sum up what the change does and which files it touches.
  3. Run the tests in that copy.
  4. If the change affects something you can see, try it by hand.
  5. Write your review, then remove the copy from .claude/worktrees/.

More quick tips

Keep reading
All guides →