STUPID-2026-0132

Gemini CLI's /restore deleted and reverted files excluded via .git/info/exclude, not just .gitignore

5.0medium
October 6, 2026Source checkedRepro reported

Why 5/10

Files excluded via .git/info/exclude are deleted by /restore. Shown in reproductions, not in a reported real loss.

Scope
1/4
A few files, one session, one credential, or a small cost
Recoverability
3/3
Permanently lost or irreversible, including data that was exposed
Did it happen
1/2
Demonstrated (proof of concept, reproduction, controlled test or near-miss) with no real victim reported
Beyond the user
0/1
Only the user's own non-production work

The score is the sum of these four factors. How each factor is scored · scored 2026-10-29

  1. Instruction given

    No specific task — this surfaces during ordinary use of Gemini CLI's built-in checkpointing. The reporter excluded a personal notes file via `.git/info/exclude` (not `.gitignore`), let Gemini edit a tracked file to create a checkpoint, created the excluded file, and then ran `/restore` to roll back to that checkpoint.

  2. Expected behavior

    Files excluded from Git tracking via `.git/info/exclude` or the user's global `core.excludesFile` should be left untouched by `/restore`, exactly like files ignored through the project's `.gitignore`.

  3. Actual behavior

    Gemini CLI's checkpoint system snapshots and restores state through an isolated shadow Git repository. That shadow repo reads the project's `.gitignore` but has no visibility into `.git/info/exclude` or the user's global `core.excludesFile`, so it treats files excluded only through those mechanisms as part of the trackable state. A file created after the checkpoint and excluded this way was deleted outright by `/restore`; a file that existed before the checkpoint and was edited afterward was silently reverted to its old checkpoint contents.

  4. Damage

    In the reporter's reproduction, a personal notes file (`notes.local.md`) excluded via `.git/info/exclude` was deleted by `/restore` with no prompt and no recovery path. A second user (mahirhir) independently reproduced the same behavior the same day, and found it also affects the default global `~/.config/git/ignore` and linked worktrees. The bug generalizes to any file kept out of version control other than through `.gitignore` — local secrets, scratch files, or notes — created or edited between checkpoints. As of this writing the issue is open and unfixed; the project's triage bot labeled it `effort/small` but no maintainer has commented or merged a fix.

Full write-up

A Gemini CLI user excluded a personal notes file from version control the normal way for secrets and scratch content — through .git/info/exclude rather than .gitignore — then used the CLI's checkpoint feature while editing a tracked file. Running /restore to roll back to that checkpoint deleted the excluded file outright. The cause: Gemini CLI's checkpoint system keeps its own shadow Git repository to snapshot and restore project state, and that shadow repo only consults the project's .gitignore — it has no way to see .git/info/exclude or a user's global core.excludesFile, so it treats anything excluded only through those mechanisms as fair game. A file created after the checkpoint is deleted; one that existed before and was later edited is silently reverted to its old contents. A second developer reproduced the bug independently the same day and found it also breaks the default global ignore file and linked worktrees. It is a narrow precondition — most users rely on .gitignore alone — but exactly the kind of precondition people reach for when they specifically want something kept out of a repo without being tracked anywhere, which makes the files it destroys disproportionately the ones nobody has a second copy of.

Classification

Failure mode
Destructive Action
Root cause
Logic Error
Domain
Infra
OWASP Agentic Top 10 (our mapping)
ASI02 Tool Misuse and Exploitation list
MIT AI Risk Repository (our mapping)
7.3 Lack of capability or robustness taxonomy

Related incidents

Cite this record
StupidLLM. "STUPID-2026-0132: Gemini CLI's /restore deleted and reverted files excluded via .git/info/exclude, not just .gitignore." AI Agent Incident Database, 2026. https://www.stupidllm.com/incident/STUPID-2026-0132/ (accessed 2026-11-11). CC BY 4.0.

← STUPID-2026-0131By IDSTUPID-2026-0133 →

Get told when an agent breaks something

We document AI agent failures daily, severity-scored against a published scale. Each Monday, if any scored 7 or above that week — deleted data, leaked secrets, broken production — you get one email with the sources. When nothing did, you get nothing.

This database is callable over MCP — query it from inside your agent.