A backport or release handoff often depends on one recorded Git change. Codex commit review targets that change so feedback stays tied to a specific commit rather than the branch or uncommitted working tree.
The target SHA must resolve in the local repository. A rebase, squash, or amend creates a different commit identity, so review feedback belongs to the SHA actually inspected.
An installed, authenticated Codex CLI can review a commit from your existing checkout. Repository content may reach the configured provider, so only code you are authorized to share belongs in the review.
Steps to review a commit with Codex:
- List recent commits from the repository containing the change.
$ git log --oneline -n 2 387121d Add average helper 0310379 Add arithmetic helper
If the commit exists only on a remote branch, its history must be fetched before it can be selected locally.
- Resolve the selected commit to its full SHA.
$ commit=$(git rev-parse --verify 'HEAD^{commit}')HEAD selects the current commit. For an older change, replace HEAD with its SHA or tag; the commit suffix rejects a name that does not resolve to a commit.
- Inspect the selected commit's change summary.
$ git show --stat --oneline "$commit" 387121d Add average helper math_utils.py | 5 +++++ 1 file changed, 5 insertions(+)
- Run a review of the selected commit.
$ codex review --commit "$commit"
Progress and the final review appear directly in the terminal. The review target is the change introduced by the selected commit. If authentication is missing, sign-in must be restored before another review.
Related: How to check Codex login status
Related: How to fix the Codex trusted-directory error - Read the terminal findings for the selected commit.
The new average helper raises the wrong exception for its explicitly documented empty-input case. Review comment: - [P2] Raise ValueError for empty input before dividing — /work/example-app/math_utils.py:7-7 For empty input such as `[]`, this expression divides by zero and raises `ZeroDivisionError`, contradicting the documented `ValueError` contract. Callers handling the promised exception will not catch it. Explicitly check for empty input and raise `ValueError` before dividing.
A finding names the file, line range, and suspected defect for human assessment. A review with no findings does not prove the commit is free of defects.