A base-branch review checks the full change set a feature branch would merge into its target branch. Running Codex against that comparison catches interactions between commits before the branch becomes a pull request or before a maintainer reviews the same diff in GitHub.
The codex review --base <BRANCH> command runs the non-interactive Codex reviewer against a branch comparison from the repository where the command starts. The base can be a local target such as main or release/2026.06, but it must resolve in Git before Codex can build the diff.
Fetch or update the target branch before reviewing when the remote branch has moved. The review can include the diff plus nearby repository context sent to the configured Codex backend, so keep generated files, private tokens, and unrelated work in progress out of scope before starting.
Steps to review changes against a base branch with Codex:
- Open a terminal in the Git repository that contains the feature branch.
$ 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 - Confirm the current branch.
$ git branch --show-current feature/retry-cap
- Confirm the base branch resolves locally.
$ git branch --list main main
Replace main with the branch the feature branch should merge into. Fetch or update the local target first if the remote base has moved.
- Preview the branch-level diff summary.
$ git diff --stat main...HEAD app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
The triple-dot comparison uses the merge base between main and HEAD, which matches the branch-review scope more closely than a plain two-dot range after the branches diverge.
- Run the base-branch review with Codex.
$ codex review --base main The patch changes existing behavior for attempt 0 by introducing a positive delay, which can break zero-based retry callers. The lower-bound fix should preserve the prior zero-delay case while handling negative attempts. Review comment: - [P2] Preserve zero-delay attempt 0 - /home/user/projects/example-app/app.py:2-3 If callers use a zero-based retry counter, `retry_delay(0)` now returns `0.25` instead of the previous `0.0`, adding an unintended delay before the first retry. The lower-bound guard should avoid negative delays without changing the documented zero-attempt behavior.
If Codex reports missing authentication, fix the active session before rerunning the same branch comparison. For repeated review criteria, keep the instructions in AGENTS.md or a repository review file such as code_review.md.
Related: How to check Codex login status - Save the review output when it needs to be shared or compared after later branch edits.
$ codex review --base main > codex-base-review.txt
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.