I’m using worktree to generate two different versions of a complex feature and then compare them to see which implement the most robust functionalities. Both plans generated by the two different models involve making changes to a database. I wonder if I actually implement the two versions of code changes, will there be code or database related conflicts? Is the worktree mode suitable or dangerous for changes involving database adjustments? If I continue to use worktree, how can I prevent database related conflicts?
If I understood you correctly, you need separate test databases.
You can use setup scripts to initialize a new database, import test data for the new worktree and provision a .env file for agent access if it needs a database.
https://cursor.com/docs/configuration/worktrees#initialization-script