[BUG] Squash request force-pushed uncommitted working-tree changes (git add -A after reset --soft)

Status Fixed / completed
Maintainer reply None cached
Activity 1 comment · opened Sep 28, 2026 · closed Sep 28, 2026

What happened

I asked Claude Code to squash the commits on a branch that were already pushed to the remote into one commit and push again.

Claude ran git reset --soft <base> followed by git add -A. This put uncommitted working-tree changes into the squash commit: modified files that had never been committed, plus untracked files. It then force-pushed that commit to the remote.

After I pointed this out, it force-pushed a second time to undo it. The first bad commit can still be opened on GitHub by its hash.

Before squashing, it also spent time on work that wasn't needed: a secret scan, listing uncommitted files, and asking about scope. All of that happened only because it planned to push uncommitted files.

Expected

Squash only the existing commits and force-push. Leave uncommitted working-tree changes alone and keep them out of the push.

Cause (verified in session)

Claude did not build the squash commit from the existing commit tree (for example with git commit-tree HEAD^{tree}, or with reset --soft and then commit without add). It staged the whole working tree with git add -A instead.

Repro

  1. Use a branch whose commits are all pushed, and have uncommitted modified files and untracked files in the working tree.
  2. Ask: "squash all commits into one and push again."
  3. Claude runs reset --soft + add -A + commit + force push.

Environment

  • Claude Code CLI, model claude-opus-5-5, macOS (Darwin 25.6.0)
  • Date: 2026-09-28

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗