Cursor Agent edits aren’t in your main folder. You’re in a worktree
Cursor Agent edited a Git worktree, so files are not in your main checkout. Run git worktree list, then /apply-worktree, open a PR, or /delete-worktree. Short answer: 5 steps. 1) Confirm the agent is editing a separate checkout; 2) List worktrees, then open the one that has the diff; 3) Bring changes into your main checkout with /apply-worktree; 4) Or ship straight from the worktree; 5) Delete finished worktrees and watch cleanup caps.
Last updated: · This page is the decision checklist; the tools list for “Bring Cursor worktree changes back to your main checkout” is a separate URL.
How do I bring Cursor worktree edits back to the main checkout?
Confirm the agent is editing a separate checkout
Worktrees give each Agent task its own Git checkout so parallel runs don’t collide. In the Agents Window, starting or moving an agent into a worktree creates that checkout; in the IDE, `/worktree` keeps the rest of the chat there; in the CLI, `agent --worktree [name]` (or `-w`) does the same under `~/.cursor/worktrees/`. Your main folder stays untouched on purpose. Docs: https://cursor.com/docs/configuration/worktrees
List worktrees, then open the one that has the diff
Run `git worktree list` in the repo. Open the worktree path Cursor created (or continue in the Agents Window review) and verify the files and branch there. If local installs or env files are missing in a fresh worktree, add `.cursor/worktrees.json` with `setup-worktree` / OS-specific setup keys so the next worktree copies `.env` and runs `npm ci` (or your install). Debug setup under Output → Worktrees Setup.
Bring changes into your main checkout with /apply-worktree
When you want to test or continue in your everyday folder, run `/apply-worktree` in the IDE. Worktree runs do not merge themselves. After you apply, re-run tests in the main checkout before you commit there.
Or ship straight from the worktree
Often you can commit and push from the worktree and open a PR without touching main. Ask the agent: “Commit and push these changes, then open a PR.” For multi-model runs, `/best-of-n` puts each candidate in its own worktree—pick a winner, then apply or PR from that checkout only.
Delete finished worktrees and watch cleanup caps
When you’re done, `/delete-worktree` removes the isolated checkout. Cursor 3.5+ can also auto-clean older worktrees (default max 25 per machine; interval via `cursor.worktreeCleanupIntervalHours` / `cursor.worktreeMaxCount`), including ones created with `/worktree` or `git worktree add`. CLI worktrees share the same retention rules: https://cursor.com/docs/cli/using
Which tools are best to bring Cursor worktree changes back to your main checkout?
Worktrees
Agents Window worktrees, /worktree, /apply-worktree, /delete-worktree, and worktrees.json setup.
Using Agent in CLI
agent --worktree / -w flags and shared cleanup rules with editor worktrees.
Git worktree list
List and inspect every linked checkout when Cursor’s UI path is unclear.
Parallel Agents overview
Same page covers /best-of-n candidate worktrees before you apply a winner.
Open: 1 spot per week
One labeled sponsor for this topic each week; this week's spot is open. See open weeks →
All tools for “Bring Cursor worktree changes back to your main checkout” →
Related fixes
- Stop a Cursor agent loopHow to fix a Cursor agent loop (same edit, or work after Stop)Fix →
- Claude Code vs Codex vs Cursor ~$20 plansClaude Code vs Codex vs Cursor $20 plan limits: how to pick without burning the weekFix →
- Scan a vibe-coded app for leaked API keysCheck a vibe-coded app for leaked API keys before you share itFix →
- Add an MCP server to Claude Code, Cursor, or CodexHow to add an MCP server to Claude Code, Cursor, or CodexFix →
See also AI tools launched today on the daily board.
NewAIToolsToday Daily
Top 3 AI launches, one model or news item that matters, and one simple fix. A 5-minute read, every weekday.