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