Uncommitted work can span the index, the working tree, and files that Git has not tracked yet. Running a Codex review before committing gives the whole in-progress change set another pass while the edits are still easy to fix.
The codex review --uncommitted command runs the non-interactive reviewer from the repository where it starts. The command help defines the scope as staged, unstaged, and untracked changes, so check Git status first to understand what Codex will inspect.
Review output is advisory, and the diff plus nearby repository context can be sent to the configured Codex backend. Keep unrelated edits out of the working tree, scan config or log snippets for secret-like values before review, and rerun the command after meaningful fixes because Codex reads the current working tree state at run time.
Steps to review uncommitted changes with Codex:
- Confirm the repository root that Codex will use.
$ git rev-parse --show-toplevel /home/user/projects/example-app
If Codex stops with a trusted-directory error, fix the repository trust policy before rerunning the review.
Related: How to fix the Codex trusted-directory error - Check the working tree status.
$ git status --short MM math.py ?? helpers.py
MM means math.py has both staged and unstaged edits. ?? marks an untracked file that codex review --uncommitted can also inspect.
- Inspect the staged diff.
$ git diff --cached diff --git a/math.py b/math.py index 4693ad3..c064e26 100644 --- a/math.py +++ b/math.py @@ -1,2 +1,6 @@ def add(a, b): return a + b + + +def divide(a, b): + return a / b - Inspect the unstaged diff.
$ git diff diff --git a/math.py b/math.py index c064e26..63df01e 100644 --- a/math.py +++ b/math.py @@ -4,3 +4,8 @@ def add(a, b): def divide(a, b): return a / b + + +def average(values): + total = sum(values) + return total / len(values)git diff shows working-tree edits that are not staged. Use git diff --cached for the index and git status --short for the combined scope.
- List untracked files before sending the review.
$ git ls-files --others --exclude-standard helpers.py
Open untracked files separately when they may contain generated data, private configuration, or copied logs that should stay out of the review.
- Run the uncommitted review with Codex.
$ codex review --uncommitted The new `average()` helper fails when callers pass an empty collection or a one-pass iterator. That leaves two regressions in the current working tree before commit. Review comment: - [P2] Materialize values once before averaging - /home/user/projects/example-app/math.py:9-11 If callers pass a generator expression, `sum(values)` consumes it before `len(values)` is checked, and non-sized iterables raise `TypeError`. Convert to a list once, reject empty input explicitly, then divide by the materialized length.
If Codex reports missing authentication, fix the active session before rerunning the same working tree.
Related: How to check Codex login status - Save a fresh review run when the output needs to be shared or compared after more edits.
$ codex review --uncommitted > codex-uncommitted-review.txt
The redirected command runs the review again. Rerun it only after the working tree has settled, or the saved output may describe a different change set.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.