[BUG] Squash request force-pushed uncommitted working-tree changes (git add -A after reset --soft)
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
- Use a branch whose commits are all pushed, and have uncommitted modified files and untracked files in the working tree.
- Ask: "squash all commits into one and push again."
- 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
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗