I asked cursor to rename a bunch of files, to have the name ‘Test’ in their name, so that they are properly picked up by PHPUnit to be tested. It seems that Cursor created new files and deleted the old ones, resulting in the files no longer being under source control.
Steps to Reproduce
I am not going to attempt that, for obvious reasons.
Expected Behavior
Renaming files shouldn’t remove them from version control.
This is a known issue. The agent is currently doing renames as “create new + delete old” instead of using git mv, which breaks file history in version control. The team is aware and tracking it.
A few tips for now:
If you still have the window open, try reverting the agent’s changes using checkpoints (click the checkpoint restore button in chat), then do the renames manually with git mv in the terminal.
Even if you’ve already committed, Git is usually smart enough to detect renames if the file contents didn’t change much. Running git log --follow <new-file-name> will still track history in most cases.
As a workaround for future renames, you can explicitly tell the agent to “use git mv in the terminal”. This forces it to use the terminal tool instead of create/delete file operations.