Worktree changes not saved

When agent works in a worktree and writes to a file, the changes are not actually saved on the disk.
In the screenshot below agent created new files: Organization and CurrencyConverter and modified User file. On disk both organization and currencyconverter files are empty and user file does not contain the changes agent made.
I must go through all the changed files, save them manually and then the files are modified on the disk.
The problem is when agent tries to run a test in the worktree, it fails because no changes are actually there, unless I manually save them.
I believe this should not be the case.

image

Version: 2.1.0-pre.2.patch.0 (user setup)
VSCode Version: 1.99.3
Commit: d3c12e88360374a70d1a6729bae06ca5444bb080
Date: 2025-11-02T08:14:12.227Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.19045

3 Likes

also when i click “apply all changes”, not all files are copied from worktree into the main project folder

1 Like

hi @liquefy , the changes are usually applied when “Apply All Changes” is clicked, and they should be all copied over.

I will file the issue internally for the team.

1 Like

I have also experienced this problem today when first trying agents with worktrees. The agent modified an existing file alright, but it created 5 new files (as planned), but no matter how much I pushed Apply All, Reapply, Create PR (went through github merge pull request) - the files stayed empty. I had to manually copy the contents from Cursor to physical files to apply edits.

3 Likes

yes, there are two issues i am experiencing:

  1. when clicking “apply all”, not all of the modified files are moved over (there is a selection between “pending changes” and “all changes” to be moved from the worktree and in my experience both of these fail to move over all the changes)
  2. when agent modifies a file within the worktree, it is not actually written to the file on disk and only visible within cursor ide → this is a problem because i might task the agent to create tests in the worktree, it writes them and when it tries to run the tests within the worktree to verify they are correct → they do not work because they are empty files

on top of that, if im not mistaken, once i accept the changes from the worktree to be moved over, i have the option to revert but after reverting no option to apply again and also once i apply changes, the “review changes” button disappears from the chat so unless i kept the review tab open, i have no option to revert or review changes that were made

6 Likes

I got the same issue that it only creates empty files. Unfortunately this makes using Cursor pretty much unusable :confused:

this is the stupidest bug… literally nothing actually commits the work… who wrote this BS? its completely broken… cursor is completely unusable in with this “feature”….. you need to fix this ASAP

1 Like

I’m getting this issue as well. makes parallel agents / worktrees unusable. I’m on windows. please fix!

That’s not how Cursor used to work before this change - I want the changes visible as the files are edited without having to apply. It’s buggy AF at the moment.

1 Like

Reported the same issue here i think - basically unusable - "Local" selection still works in the worktree

I’ll be switching to an alternative if this continues - Kilo Code.

Yup, I’ve got the same issue. What I’ve discovered happens:

  1. You need to run a multi-agent scenario using worktree.
  2. When the agents are finished, they create empty files for the work. They then add the code to the files in the IDE, but do not save the changes to those files (respective to each individual worktree)
  3. When you click Apply, it copies across the BLANK files, and so in my case using Node + NextJS, it breaks the app.
  4. To solve this:
    1. You must first make sure the changes are NOT applied (or unapply the changes if you applied them)
    2. Save all the files open in the IDE. (You can individually go through and save 1 by one, or choose save all.) I usually choose to save all, then close all, to make sure I know I’ve got everything saved.
    3. Now you can go ahead and click “Apply”, and the it will copy the fully coded file as expected.
  5. If you want to make any follow up changes to a particular agent
    1. You have to first click unapply, otherwise it changes the local and then the unapply button disappears
    2. Once the change is made, you will again see a number of unsaved files in the IDE.
    3. Save these files again (You can individually go through and save 1 by one, or choose save all.) OR IT WILL NOT update.
    4. Now you can click Apply again and it will apply the latest changes.

Either there is a setting I’m unaware of to autosave the changes from the agents into the worktrees, or this is a bug. If it is the latter, it would be great if this is fixed, because I often forget to save first when I’m doing follow up minor changes, and it’s highly frustrating!

Has this been fixed in version 2.2? I see mention of improvements, but not this specifically. I mean what I describe in the thread and here: Worktree changes not saved - #6 by liquefy
@Colin

Hey there @liquefy

This is still open on our side, but gaining traction and priority.

1 Like

any ETA? this issue is keeping me in Claude Code when i’d prefer to be in cursor

1 Like