/undo destructively interacts with git staging

Resolved 💬 1 comment Opened Dec 17, 2025 by k-thornton Closed Dec 19, 2025

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_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗