claude-code - 💡(How to fix) Fix [BUG] Claude carelessly deletes uncommited work by dropping git stash that failed to pop (commonly repeating pattern) [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#50817Fetched 2026-04-20 12:12:14
View on GitHub
Comments
2
Participants
3
Timeline
8
Reactions
0
Timeline (top)
labeled ×6commented ×2

Error Message

Error Messages/Logs

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

This is a repeating pattern I saw 3 times in just the last 2 days with Claude Opus 4.7 .

The pattern happens most easily with multiple claude agents working in the same repo.

  • Agent A performs failing unit test
  • Agent A performs git stash to see if current WIP changes caused test failure
  • Agent B change some file
  • Agent A pops stash after running test, but pop fails due to conflict after agent B's change
  • Agent A drops the stash, deleting the uncommited WIP files. Agent A completely fails to verify whether stash pop was actually applied.

What Should Happen?

Since this is such a serious and frequent weakness that may cost a lot of tokens before users even notice it, I suggest giving explicit training on Opus models to avoid this mistake when deleting files such as with git stash. It should be better at verifying that deletion is OK.

Error Messages/Logs

Steps to Reproduce

Put multiple claude agents to work in the same folder, with git version control and unit tests. It was claude's own idea to perform git stash/drop and delete work.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.114

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Note: You may restore the lost stash commit from unreachable part of git, before it is GC cleaned. Claude did this automatically in one instance.

extent analysis

TL;DR

To mitigate the issue, consider implementing a verification step after git stash pop to ensure changes are applied correctly before dropping the stash.

Guidance

  • When using multiple Claude agents in the same repository, be cautious of concurrent changes that may lead to conflicts during git stash pop.
  • After Agent A pops the stash, verify that the changes are applied correctly before dropping the stash to avoid losing uncommitted work.
  • Consider adding a check to ensure that the stash pop was successful before proceeding with other operations.
  • Review the git documentation on stash and conflict resolution to better understand how to handle such scenarios.

Example

No specific code example is provided as the issue is more related to the workflow and usage of git stash rather than a specific code snippet.

Notes

The issue seems to be related to the interaction between multiple agents and the git version control system, particularly with the use of git stash. The lack of explicit training on Opus models to handle such scenarios is highlighted as a potential contributing factor.

Recommendation

Apply workaround: Implement additional verification steps after git stash pop to ensure changes are applied correctly, as the root cause seems to be related to the workflow and interaction between agents rather than a specific version issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING