Worktree doesn't create branch correctly

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When start a new agent session, and choose to work in a worktree / master,cursor does work in an isolated directory, but it doesn’t create a corresponding git branch for that worktree.

Steps to Reproduce

new agent, choose workttree/master, click open terminal in worktree, run git branch

Expected Behavior

create a corresponding branch for that session. if there’s no branch, when master is updated, I cannot merge the code.

Screenshots / Screen Recordings

Operating System

Windows 10/11

Version Information

Version: 2.6.13 (system setup)
VSCode Version: 1.105.1
Commit: 60faf7b51077ed1df1db718157bbfed740d2e160
Date: 2026-03-06T06:17:49.499Z
Build Type: Stable
Release Track: Default
Electron: 39.6.0
Chromium: 142.0.7444.265
Node.js: 22.22.0
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.22621

Does this stop you from using Cursor

No - Cursor works, but with this issue

Hey, thanks for the report. This is a known bug. The branch name isn’t being passed correctly from the UI when creating a worktree, so you end up in a detached HEAD state instead of a proper branch.

The team is aware of this, and your report helps us prioritize it.

As a workaround, you can create the worktree manually and then point the agent to it:

  1. Create a worktree with a branch in the terminal:
git worktree add ../my-worktree -b feature/my-branch
  1. Open a new chat in Cursor
  2. Switch from “Local” to “Worktree”. The manually created worktree should show up in the list
  3. Select it, and the agent will work in that worktree on a proper branch

This way you’ll have a real branch you can merge back into master.

Let me know if that helps.

Thx a lot!And there’s another user experience problem when using worktree: when you start a new session on a worktree, the session panel is still retaining in the current window. I have to create a new cursor window to open the worktree directory, so that I can run some commands to verify the result, but if there’s any problem, I have to jump back to the original window, find that session and copy the errors, and then jump back to the worktree window to verify again. This is super inconvenient sometimes!

Hey, good point about the UX. It really is inconvenient to switch back and forth between windows to check the result and copy errors back into the session.

I’ll pass this feedback on to the team.

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.