Add dirty worktree check before merge to prevent unsaved changes from being lost
This commit is contained in:
parent
9b8d4d882e
commit
7c46b28aab
|
|
@ -413,6 +413,12 @@ program
|
||||||
.description("Merge a branch into main and close the session")
|
.description("Merge a branch into main and close the session")
|
||||||
.action(async (branch: string) => {
|
.action(async (branch: string) => {
|
||||||
const root = await git.repoRoot()
|
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)
|
const conflicts = await git.merge(branch, root)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user