Skip to content

/undo destructively interacts with git staging #8214

@k-thornton

Description

@k-thornton

What version of Codex is running?

codex-cli 0.73.0

What subscription do you have?

business

Which model were you using?

gpt-5.1-codex-max medium

What platform is your computer?

Darwin 25.1.0 arm64 arm

What issue are you seeing?

Sometimes when taking a turn I like to git add my files to stage them. This gives me a checkpoint I can use in case the current turn goes wrong, but without creating a proper commit.

My workflow gets absolutely destroyed when using /undo. It blows away the staged files and returns everything back to unstaged when you undo. This is true even when the /undo is NOT bringing the files back to the same state as the staged files (as is the case when you have taken multiple turns, and undo the most recent one)

What steps can reproduce the bug?

modify a file in a git repo
git add that file
git status should show that file is staged
have codex take a turn which modifies a file in the repo (it does not have to be the same file)
/undo

notice that your staged changes have been reset

What is the expected behavior?

codex should never mess with my git status/history/staging unless explicitly told to do so.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions