How to review changes against a base branch with Codex

Base-branch reviews are useful before opening a pull request or merging a feature branch because they check the full change set that would land on the target branch. That keeps the review centered on the branch-level diff instead of on one commit or only the uncommitted working tree.

The codex review command supports this workflow with --base <branch>, which reviews the changes between the checked-out branch and the named base branch. In a repository that uses main as the merge target, running codex review --base main from a feature branch asks Codex to assess what that branch would introduce relative to main.

The base branch reference must exist locally, and it should be up to date if you want the review to reflect the latest merge target. Review findings are heuristic rather than authoritative, and depending on your Codex configuration, diff context may be sent to a remote backend for analysis, so remove secrets before running the command.

Steps to review changes against a base branch with Codex:

  1. Open a terminal in the root of the Git repository that contains the branch you want to review.
    $ cd ~/src/example-app
  2. Print the current branch so you know which branch Codex will compare against the base branch.
    $ git branch --show-current
    feature/retry-delay
  3. Confirm the base branch exists locally before running the review.
    $ git branch --list main
      main

    Replace main with the actual merge target in your repository, such as master or a release branch, and update that branch first if it is stale.

  4. Review the diff summary against the base branch to confirm the scope that Codex will inspect.
    $ git diff --stat main...HEAD
     app.py | 4 ++++
     1 file changed, 4 insertions(+)
  5. Run the Codex review against the base branch.
    $ codex review --base main
    The patch only adds a small standalone helper and does not introduce any clearly incorrect behavior based on the current codebase and diff. I did not find a discrete, actionable bug that is provably introduced by this change.

    Add a short prompt after the command when you want the review to focus on a specific risk, such as backward compatibility or performance.

  6. Save the review output to a file when you need to share it or keep it with the branch work.
    $ codex review --base main > codex-base-review.txt