I've had codex delete the entire project directory including .git, and the only thing that saved me was a remote copy.