feat: support git worktrees in code review#241
Merged
backnotprop merged 3 commits intomainfrom Mar 7, 2026
Merged
Conversation
Detect worktrees via `git worktree list --porcelain` and surface them as selectable diff options in the existing dropdown. When a worktree is selected, run git commands with cwd set to that worktree's directory. Closes #196 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Selecting a worktree now enters "worktree mode" — the dropdown replaces its contents with standard diff options (uncommitted, last-commit, vs main) scoped to that worktree. A "Back to main repo" entry returns to the original view. - Add parseWorktreeDiffType() for compound types like worktree:/path:last-commit - Add getWorktreeDiffOptions() to build worktree-mode dropdown entries - Update runGitDiff() to handle worktree sub-types - Update /api/diff/switch to return diffOptions on mode transitions - Update App.tsx to consume updated diffOptions and refresh dropdown - Add test sandbox with 4 worktrees for manual testing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
`git diff HEAD~1..HEAD` crashes when a branch has only one commit. Now checks for HEAD~1 existence first and falls back to `git diff --root HEAD` to show the initial commit's full content. Also fixes test sandbox: wrong filename in git add, and commits changes in fix-parser/detached worktrees so "Last commit" and "vs main" have actual content to display. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
git worktree list --porcelainand surfaces them as selectable diff options in the existing dropdowngit diff HEADwithcwdset to that worktree's directory, picking up uncommitted + untracked changes thereCloses #196
Test plan
git worktree add ../test-wt -b test-branch../test-wt//plannotator-reviewfrom the main repo🤖 Generated with Claude Code