From a905acc83dc1a0d5dd9a773d6437a36a2fd64783 Mon Sep 17 00:00:00 2001 From: autocommit Date: Fri, 17 Apr 2026 23:16:58 -0700 Subject: [PATCH] =?UTF-8?q?fix(local-agent):=20=F0=9F=90=9B=20Add=20--=20f?= =?UTF-8?q?lag=20to=20safely=20unstage=20changes=20on=20unborn=20branches?= =?UTF-8?q?=20during=20git=20reset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- src/auto_commit_service/tray/local_agent.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/auto_commit_service/tray/local_agent.py b/src/auto_commit_service/tray/local_agent.py index 15b0975..351ed0f 100644 --- a/src/auto_commit_service/tray/local_agent.py +++ b/src/auto_commit_service/tray/local_agent.py @@ -302,7 +302,9 @@ class LocalCommitAgent: if not message: logger.warning(f"Empty message for {repo_name}, skipping") - _git(repo_path, "reset", "HEAD") + # Unstage path-by-path — safe on unborn branches (no initial commit) + # where `git reset HEAD` fails because HEAD is unresolved. + _git(repo_path, "reset", "--", *allowed) return False # Dry-run gate — log intent, unstage, do not commit or push @@ -311,7 +313,9 @@ class LocalCommitAgent: f"[DRY-RUN] {repo_name} ({branch}) would commit {len(allowed)} file(s) " f"with message: {message.splitlines()[0] if message else '(empty)'}" ) - _git(repo_path, "reset", "HEAD") + # Unstage path-by-path — safe on unborn branches (no initial commit) + # where `git reset HEAD` fails because HEAD is unresolved. + _git(repo_path, "reset", "--", *allowed) return False # Commit