From 18bc9013d9cd9a654f4ec869c14cc92b8972d96d Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Fri, 27 Mar 2026 12:57:22 -0700 Subject: [PATCH] fix: remove --delete-branch from mergePR to prevent worktree error (#143) --- src/main/github/client.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/github/client.ts b/src/main/github/client.ts index 055db10d1..e455f7796 100644 --- a/src/main/github/client.ts +++ b/src/main/github/client.ts @@ -249,7 +249,10 @@ export async function mergePR( ): Promise<{ ok: true } | { ok: false; error: string }> { await acquire() try { - await execFileAsync('gh', ['pr', 'merge', String(prNumber), `--${method}`, '--delete-branch'], { + // Don't use --delete-branch: it tries to delete the local branch which + // fails when the user's worktree is checked out on it. Branch cleanup + // is handled by worktree deletion (local) and GitHub's auto-delete setting (remote). + await execFileAsync('gh', ['pr', 'merge', String(prNumber), `--${method}`], { cwd: repoPath, encoding: 'utf-8', env: { ...process.env, GH_PROMPT_DISABLED: '1' }