From 848522f7a9e3adce1c4b438472bccedb60c78ade Mon Sep 17 00:00:00 2001 From: nrslib <38722970+nrslib@users.noreply.github.com> Date: Thu, 29 Jan 2026 01:47:31 +0900 Subject: [PATCH] =?UTF-8?q?Try=20Merge=20=E3=82=92=20squash=20merge=20?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 変更をステージするだけでコミットしないように変更。 git status で確認し、git commit で確定、git reset で取り消し可能。 --- src/commands/reviewTasks.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/commands/reviewTasks.ts b/src/commands/reviewTasks.ts index f6cc9d0..48f4864 100644 --- a/src/commands/reviewTasks.ts +++ b/src/commands/reviewTasks.ts @@ -95,7 +95,7 @@ async function showDiffAndPromptAction( [ { label: 'View diff', value: 'diff', description: 'Show full diff in pager' }, { label: 'Instruct', value: 'instruct', description: 'Give additional instructions to modify this worktree' }, - { label: 'Try merge', value: 'try', description: 'Merge without cleanup (keep worktree & branch)' }, + { label: 'Try merge', value: 'try', description: 'Squash merge (stage changes without commit)' }, { label: 'Merge & cleanup', value: 'merge', description: 'Merge (if needed) and remove worktree & branch' }, { label: 'Delete', value: 'delete', description: 'Discard changes, remove worktree and branch' }, ], @@ -105,27 +105,29 @@ async function showDiffAndPromptAction( } /** - * Try-merge: merge the branch without cleanup. + * Try-merge (squash): stage changes from branch without committing. * Keeps the worktree and branch intact for further review. + * User can inspect staged changes and commit manually if satisfied. */ export function tryMergeWorktreeBranch(projectDir: string, item: WorktreeReviewItem): boolean { const { branch } = item.info; try { - execFileSync('git', ['merge', branch], { + execFileSync('git', ['merge', '--squash', branch], { cwd: projectDir, encoding: 'utf-8', stdio: 'pipe', }); - success(`Merged ${branch} (worktree kept)`); - log.info('Try-merge completed', { branch }); + success(`Squash-merged ${branch} (changes staged, not committed)`); + info('Run `git status` to see staged changes, `git commit` to finalize, or `git reset` to undo.'); + log.info('Try-merge (squash) completed', { branch }); return true; } catch (err) { const msg = err instanceof Error ? err.message : String(err); - logError(`Merge failed: ${msg}`); + logError(`Squash merge failed: ${msg}`); logError('You may need to resolve conflicts manually.'); - log.error('Try-merge failed', { branch, error: msg }); + log.error('Try-merge (squash) failed', { branch, error: msg }); return false; } }