diff --git a/src/cli.ts b/src/cli.ts index 37909d0..5fc02a0 100755 --- a/src/cli.ts +++ b/src/cli.ts @@ -413,6 +413,12 @@ program .description("Merge a branch into main and close the session") .action(async (branch: string) => { const root = await git.repoRoot() + const session = await state.getSession(root, branch) + + if (session && await git.isDirty(session.worktree)) { + console.error(`✖ Branch "${branch}" has unsaved changes. Run "sandlot save ${branch}" first.`) + process.exit(1) + } const conflicts = await git.merge(branch, root)