diff --git a/apps/server/src/routes/worktree/routes/checkout-branch.ts b/apps/server/src/routes/worktree/routes/checkout-branch.ts index ffa6e5e32..a774a7453 100644 --- a/apps/server/src/routes/worktree/routes/checkout-branch.ts +++ b/apps/server/src/routes/worktree/routes/checkout-branch.ts @@ -47,7 +47,7 @@ export function createCheckoutBranchHandler() { } // Get current branch for reference - const { stdout: currentBranchOutput } = await execAsync('git rev-parse --abbrev-ref HEAD', { + const { stdout: currentBranchOutput } = await execAsync('git symbolic-ref --short HEAD', { cwd: worktreePath, }); const currentBranch = currentBranchOutput.trim(); diff --git a/apps/server/src/routes/worktree/routes/commit.ts b/apps/server/src/routes/worktree/routes/commit.ts index f33cd94b7..ea31de8dd 100644 --- a/apps/server/src/routes/worktree/routes/commit.ts +++ b/apps/server/src/routes/worktree/routes/commit.ts @@ -59,7 +59,7 @@ export function createCommitHandler() { const commitHash = hashOutput.trim().substring(0, 8); // Get branch name - const { stdout: branchOutput } = await execAsync('git rev-parse --abbrev-ref HEAD', { + const { stdout: branchOutput } = await execAsync('git symbolic-ref --short HEAD', { cwd: worktreePath, }); const branchName = branchOutput.trim(); diff --git a/apps/server/src/routes/worktree/routes/create-pr.ts b/apps/server/src/routes/worktree/routes/create-pr.ts index ec7ba4dd3..2e97bca6a 100644 --- a/apps/server/src/routes/worktree/routes/create-pr.ts +++ b/apps/server/src/routes/worktree/routes/create-pr.ts @@ -43,7 +43,7 @@ export function createCreatePRHandler() { const effectiveProjectPath = projectPath || worktreePath; // Get current branch name - const { stdout: branchOutput } = await execAsync('git rev-parse --abbrev-ref HEAD', { + const { stdout: branchOutput } = await execAsync('git symbolic-ref --short HEAD', { cwd: worktreePath, env: execEnv, }); diff --git a/apps/server/src/routes/worktree/routes/delete.ts b/apps/server/src/routes/worktree/routes/delete.ts index 93857f787..3d8ef773c 100644 --- a/apps/server/src/routes/worktree/routes/delete.ts +++ b/apps/server/src/routes/worktree/routes/delete.ts @@ -38,7 +38,7 @@ export function createDeleteHandler() { // Get branch name before removing worktree let branchName: string | null = null; try { - const { stdout } = await execAsync('git rev-parse --abbrev-ref HEAD', { + const { stdout } = await execAsync('git symbolic-ref --short HEAD', { cwd: worktreePath, }); branchName = stdout.trim(); diff --git a/apps/server/src/routes/worktree/routes/info.ts b/apps/server/src/routes/worktree/routes/info.ts index 3d512452c..283957fa9 100644 --- a/apps/server/src/routes/worktree/routes/info.ts +++ b/apps/server/src/routes/worktree/routes/info.ts @@ -31,7 +31,7 @@ export function createInfoHandler() { const worktreePath = path.join(projectPath, '.worktrees', featureId); try { await secureFs.access(worktreePath); - const { stdout } = await execAsync('git rev-parse --abbrev-ref HEAD', { + const { stdout } = await execAsync('git symbolic-ref --short HEAD', { cwd: worktreePath, }); res.json({ diff --git a/apps/server/src/routes/worktree/routes/list-branches.ts b/apps/server/src/routes/worktree/routes/list-branches.ts index dc7d7d6cc..05ff3afc0 100644 --- a/apps/server/src/routes/worktree/routes/list-branches.ts +++ b/apps/server/src/routes/worktree/routes/list-branches.ts @@ -34,7 +34,7 @@ export function createListBranchesHandler() { } // Get current branch - const { stdout: currentBranchOutput } = await execAsync('git rev-parse --abbrev-ref HEAD', { + const { stdout: currentBranchOutput } = await execAsync('git symbolic-ref --short HEAD', { cwd: worktreePath, }); const currentBranch = currentBranchOutput.trim(); diff --git a/apps/server/src/routes/worktree/routes/merge.ts b/apps/server/src/routes/worktree/routes/merge.ts index ab4e0c178..c44ca4c87 100644 --- a/apps/server/src/routes/worktree/routes/merge.ts +++ b/apps/server/src/routes/worktree/routes/merge.ts @@ -35,7 +35,7 @@ export function createMergeHandler() { const worktreePath = path.join(projectPath, '.worktrees', featureId); // Get current branch - const { stdout: currentBranch } = await execAsync('git rev-parse --abbrev-ref HEAD', { + const { stdout: currentBranch } = await execAsync('git symbolic-ref --short HEAD', { cwd: projectPath, }); diff --git a/apps/server/src/routes/worktree/routes/pull.ts b/apps/server/src/routes/worktree/routes/pull.ts index 7b9229949..b00addba9 100644 --- a/apps/server/src/routes/worktree/routes/pull.ts +++ b/apps/server/src/routes/worktree/routes/pull.ts @@ -28,7 +28,7 @@ export function createPullHandler() { } // Get current branch name - const { stdout: branchOutput } = await execAsync('git rev-parse --abbrev-ref HEAD', { + const { stdout: branchOutput } = await execAsync('git symbolic-ref --short HEAD', { cwd: worktreePath, }); const branchName = branchOutput.trim(); diff --git a/apps/server/src/routes/worktree/routes/push.ts b/apps/server/src/routes/worktree/routes/push.ts index b044ba00c..2b8ccb907 100644 --- a/apps/server/src/routes/worktree/routes/push.ts +++ b/apps/server/src/routes/worktree/routes/push.ts @@ -29,7 +29,7 @@ export function createPushHandler() { } // Get branch name - const { stdout: branchOutput } = await execAsync('git rev-parse --abbrev-ref HEAD', { + const { stdout: branchOutput } = await execAsync('git symbolic-ref --short HEAD', { cwd: worktreePath, }); const branchName = branchOutput.trim(); diff --git a/apps/server/src/routes/worktree/routes/switch-branch.ts b/apps/server/src/routes/worktree/routes/switch-branch.ts index d087341b6..36be8d2cb 100644 --- a/apps/server/src/routes/worktree/routes/switch-branch.ts +++ b/apps/server/src/routes/worktree/routes/switch-branch.ts @@ -87,7 +87,7 @@ export function createSwitchBranchHandler() { } // Get current branch - const { stdout: currentBranchOutput } = await execAsync('git rev-parse --abbrev-ref HEAD', { + const { stdout: currentBranchOutput } = await execAsync('git symbolic-ref --short HEAD', { cwd: worktreePath, }); const previousBranch = currentBranchOutput.trim();