gemini-cli - 💡(How to fix) Fix Gemini 3 Flash in Gemini CLI tried to discard my work when asked to commit the changes

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…

Error Message

This constituted a severe operational error that placed the integrity of the work at risk.

Root Cause

Technical Root Cause The failure originated from a confusion between two Git "patch" mode interfaces.

  • Intent: To perform "surgical" staging, isolating specific changes within large files into separate logical commits.
  • Action: I invoked the destructive variant of the patch interface, which is designed to revert uncommitted work to its last known-good state.

Fix Action

Fix / Workaround

Technical Root Cause The failure originated from a confusion between two Git "patch" mode interfaces.

  • Intent: To perform "surgical" staging, isolating specific changes within large files into separate logical commits.
  • Action: I invoked the destructive variant of the patch interface, which is designed to revert uncommitted work to its last known-good state.
RAW_BUFFERClick to expand / collapse

What happened?

I usually spin up Gemini CLI and switch to YOLO mode to perform a /smart-commit which analyzes the changes in the working tree and creates multiple logical commits if the changes span distinct purposes.

Thankfully, I didn't, since Gemini ran git status, git diff and then tried to git checkout -p the files that were meant to be staged.

I mean WTH!!!! I ask to commit and it tries to discard??? Imagine the disaster I happened to avoid by accident mostly!!

Unacceptable!

What did you expect to happen?

I expected Gemini to commit my changes not attempt to discard them!!!

Client information

  • CLI Version: 0.42.0
  • Git Commit: 68e2196d5
  • Session ID: cfa4ab75-23c7-4fbd-9d3b-5c06b42bd85a
  • Operating System: darwin v24.11.0
  • Sandbox Environment: no sandbox
  • Model Version: gemini-3-flash-preview
  • Auth Type: oauth-personal
  • Memory Usage: 193.8 MB
  • Terminal Name: Unknown
  • Terminal Background: #212734
  • Kitty Keyboard Protocol: Unsupported

Login information

Google account.

Anything else we need to know?

Gemini's report:

Incident Report: Critical Command Selection Failure

Incident Overview During a source control operation intended to stage and commit code, I executed a command that initiates the interactive discarding of local changes (git checkout -p) instead of the command for interactive staging (git add -p). This constituted a severe operational error that placed the integrity of the work at risk.

Technical Root Cause The failure originated from a confusion between two Git "patch" mode interfaces.

  • Intent: To perform "surgical" staging, isolating specific changes within large files into separate logical commits.
  • Action: I invoked the destructive variant of the patch interface, which is designed to revert uncommitted work to its last known-good state.

Impact and Risk Assessment The primary risk was the permanent loss of uncommitted logic. Had the command proceeded, it would have prompted for the removal of the very code I was instructed to preserve and commit. This represents a fundamental violation of the "Security & System Integrity" mandate, specifically regarding the protection of the source tree.

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

gemini-cli - 💡(How to fix) Fix Gemini 3 Flash in Gemini CLI tried to discard my work when asked to commit the changes