From 7d11a8a5603719e5fff6a104de195a6a206ba679 Mon Sep 17 00:00:00 2001 From: Jubarte Date: Fri, 10 Jul 2026 15:55:32 -0300 Subject: [PATCH 1/2] fix: handle dirty state when creating new branch --- scripts/cli.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/cli.ts b/scripts/cli.ts index bcedd6b..f1b5614 100644 --- a/scripts/cli.ts +++ b/scripts/cli.ts @@ -1187,11 +1187,18 @@ async function main() { const name = arg1; if (!name) die('branch name required — e.g. gg b feature/login (or gitgen branch feature/login)'); banner(`create branch ${name}`); - const message = await resolveMessage(messageFlag, "feat: new branch"); + const dirty = await hasChanges(); + const message = dirty + ? await resolveMessage(messageFlag, "feat: new branch") + : "feat: new branch"; await runSteps(async () => { await git(["checkout", "-b", name]); - await git(["add", "."]); - await git(["commit", "-m", message]); + if (dirty) { + await git(["add", "."]); + await git(["commit", "-m", message]); + } else { + log(` ${c.dim("nothing to commit — pushing branch only")}`); + } await git(["push", "-u", "origin", name], { progress: true }); }); return; From 4d18779485dfc6df311721dcdbcfb9e6dd2a5689 Mon Sep 17 00:00:00 2001 From: Jubarte Date: Fri, 10 Jul 2026 15:59:40 -0300 Subject: [PATCH 2/2] fix: handle dirty state when creating new branch --- scripts/cli.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/cli.ts b/scripts/cli.ts index f1b5614..fd2a7fc 100644 --- a/scripts/cli.ts +++ b/scripts/cli.ts @@ -1188,12 +1188,10 @@ async function main() { if (!name) die('branch name required — e.g. gg b feature/login (or gitgen branch feature/login)'); banner(`create branch ${name}`); const dirty = await hasChanges(); - const message = dirty - ? await resolveMessage(messageFlag, "feat: new branch") - : "feat: new branch"; await runSteps(async () => { await git(["checkout", "-b", name]); if (dirty) { + const message = await resolveMessage(messageFlag, "feat: new branch"); await git(["add", "."]); await git(["commit", "-m", message]); } else {